を、あなたが実際にやろうとしているかについては何も言ってはいけないときに答えるために、その難しいです。 次は良いしませんが、それはあなたの質問に答える:あなたの更新に基づいて
<div>
<div id="a">a</div>
<div id="b">b</div>
</div>
<style>
div { width: 100px }
#a{ background: red; float:left }
#b{ background: blue; float:right }
</style>
EDIT
を、あなたが必要なものを行の高さである:
<div id="container">
<div id="a">
<p>lorem ipsum whatever</p>
</div>
<div id="b">
<p>Praesent commodo cursus magna, vel scelerisque nisl consectetur et.</p>
</div>
</div>
<style>
#container { width: 500px }
#a,#b{ display: block; float:left; width: 240px; background: red; line-height: 35px; height:35px }
p{ line-height: 1em; display: inline-block; }
</style>
This updated Fiddleを示して概念。基本的には、容器はheight
とline-height
を必要とするので、height
= line-height
となる。
なぜあなたはそれを行うのでしょうか? –
私はjsで書く何らかの種類のオートコンプリーに必要です。 – santino
それはあなたの要求にどのように関連していますか? –