如何在td中用标签类包装span(How to wrap span with label class in td)

编程入门 行业动态 更新时间:2024-10-12 01:21:55
如何在td中用标签类包装span(How to wrap span with label class in td)

我需要在一个范围内显示一个项目列表,其中包含类“label”:

<td> <span class="label label-default">My Item 1223</span> <span class="label label-default">My Item 2378</span> .... <span class="label label-default">My Item 898389 </span> </td>

我的问题是那些跨度不包裹在我的表中。 如下所示:

我不知道怎样继续把它包裹在我的<td> 。

如果您对如何进行有任何建议......

I need to show a list of item in span with class "label" inside a :

<td> <span class="label label-default">My Item 1223</span> <span class="label label-default">My Item 2378</span> .... <span class="label label-default">My Item 898389 </span> </td>

My issue is that those span don't wrap in my table. As you can see below:

I don't know how to proceed to make it wrap in my <td>.

If you have any advice about how to proceed...

最满意答案

将最大宽度设置为您的td。

td { max-width:230px; }

同时将标签浮动到左侧并将显示更改为display:block;

.label{ display:block; float:left; }

看我的演示

Set a max-width to your td.

td { max-width:230px; }

Also float your label to the left and change your display to display:block;

.label{ display:block; float:left; }

See my demo

更多推荐

本文发布于:2023-07-26 06:30:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1271997.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:中用   标签   如何在   td   class

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!