1
在这个例子中,我将div标签的宽度设置为200px,我希望所有的span子项都使用父div标签的所有宽度进行布局,如果第一行是填充。如何让Span文本的布局适合父div标签的宽度?
我试图做到这一点通过这一点,但我只看到1行中的所有span标签:
<html>
<body>
<div width="200px">
<span> text 1 </span> <span> text 2 </span> <span> text 8 </span> <span> text 4 </span><span> text5 </span>
<span> text 6 </span><span> text 7 </span><span> text 9 </span><span> text 10 </span><span> text 11 </span>
<span> text 12 </span><span> text 18 </span> <span> text 14 </span><span> text15 </span>
<span> text 16 </span><span> text 17 </span>
</div>
</body>
</html>
将'span'设置为'display:block;'和'width:100%;'? – Red