我有下面的HTML和CSS,這裏span
對齊到左邊。這裏的padding-right
根據span
文字大小而變化。有沒有一種方法可以在縮進中獨立於span
文本大小的同一行。對齊等於填充的跨度
.chapter {
margin-left: 5.0em;
margin-right: 0.2em;
}
.para {
text-indent: 0em;
margin-top: 0.85em;
}
.para span.phrase {
text-indent: 0em;
margin-left: -4.75em;
font-weight: bold;
padding-right: 2.8em;
}
<div class="chapter">
<div class="para">
<span class="phrase">8.04</span>The padding shorthand property sets all the padding properties in one declaration. This property can have from one to four values</div>
<div class="para"><span class="phrase">8A.03</span>
The padding shorthand property sets all the padding properties in one declaration. This property can have from one to four values</div>
<div class="para"><span class="phrase">8AA.01</span>The padding shorthand property sets all the padding properties in one declaration. This property can have from one to four values</div>
</div>
感謝
感謝,這:-)工作 – user3872094
不要忘了,如果它hepls我的朋友接受它:) – freewheeler
您的解決方案將無法工作,如果文首專欄是要長的:http://jsfiddle.net/8jhaujdv/ –