所以我模擬了一個表格佈局,裏面有一個div和一對跨度的表格。我希望右邊的範圍縮進任何包裝的文字。我已經嘗試了一些東西,但無法讓它起作用。任何幫助,將不勝感激。<span>縮進包裹文本
的jsfiddle:http://jsfiddle.net/2Wbuv/
HTML
<div class="display-element">
<span class="display-label">Field 1</span>
<span class="display-field">This is my string of data, some times it is pretty long. Sometimes it is not. This one is.</span>
</div>
<div class="display-element">
<span class="display-label">Field 2</span>
<span class="display-field">This is another string of data.</span>
</div>
CSS
.display-element {}
.display-label {display: inline-block;
width: 100px;
padding-left: 5px;}
.display-field {display: inline;}
爲什麼不使用'display:table-cell'? – sdleihssirhc
恩,天才......我從來沒有使用過,現在我不知道爲什麼。請回答,我可以給你點。 –
哦,除了現在我不能使它100%寬...仍然在努力。 –