【发布时间】:2015-08-13 05:14:26
【问题描述】:
我在一个 div 中并排放置了三个 span 元素。第三个 span 元素包含文本,我添加了 word-break css 属性,这样如果文本超过宽度,文本就会中断。现在我如何将边距应用于下一行的文本以与上面的行对齐。
<div class="legend_data" style="line-height:18px;word-break:break-word">
<span class="legend_text" style="float: left;">
<input type="checkbox" value="test">
</span>
<span style="background-color:#32CD32;float: left;width: 12px;
height: 12px;"></span>
<span class="legend_text" style="margin-left: 1%;"> sample text sample text sample text sample text sample text sample text sample text sample text sample text sample text
</span>
</div>
【问题讨论】:
-
你当前的代码是什么样的?
-
请edit您的问题包含您的代码。我不确定你想做什么。为什么一开始需要那两个
spans?为什么不简单地将padding-left设置为包含框? -
那些是
spans 图标还是类似的东西? -
请说明第二个跨度的目的是什么。它的可能内容是什么?它可以有多大?
标签: css