解決策 1:
フィドル:
http://jsfiddle.net/38GpE/2/
CSS:
.pretext
{
font-weight:bold;
display:inline-block;
vertical-align:top;
}
.text
{
width:300px;
display:inline-block;
}
HTML:
<ul>
<li>
<div class="pretext">Something: </div>
<div class="text">
...text...
</div>
</li>
</ul>
明らかな問題は箇条書きです...あなたの例では、箇条書きを非表示にして(マイナス記号)を使用<li>
するだけでよいようです。list-style:none;
-
それでも十分でない場合は、箇条書きを非表示にして a を配置するとうまくいくbackground: url(mybullet.png) no-repeat left top;
可能性があります。
解決策 2:
を使用した別のソリューションdisplay:table-cell
ですが、これは IE7 ではサポートされていないことに注意してください。ただし、この利点は、2 番目の列の幅を定義する必要がないことです。
フィドル:
http://jsfiddle.net/38GpE/3/
CSS:
.pretext
{
font-weight:bold;
display:table-cell;
vertical-align:top;
white-space:nowrap;
}
.text
{
display:table-cell;
}
解決策 #3:
コメントで、を使用する必要はないと言っていました<li>
。面倒ですが、項目ごとにテーブルを定義していただけないでしょうか。
フィドル:
http://jsfiddle.net/zuPcx/
HTML:
<table>
<tr>
<td class="pretext">Something:</td>
<td>{your text}</td>
</tr>
</table>
<table>
<tr>
<td class="pretext">Something else:</td>
<td>{your text}</td>
</tr>
</table>
CSS:
.pretext
{
font-weight:bold;
display:table-cell;
vertical-align:top;
white-space:nowrap;
}
.text
{
display:table-cell;
}