要素の上端が揃っているときにdivを囲むようにテキストを配置するのに問題はありませんが、divの上と下にテキストを折り返す方法を理解できません。divの上下にテキストを折り返す方法は?
たとえば、テキストを40pxの#containerの全幅にしてから、右に折り返してもう一度全幅にします。
http://jsfiddle.net/cope360/wZw7T/1/でご覧ください。 #insetの先頭の余白を追加したところで、テキストを折り返したいところです。これは可能ですか?
CSS:
#inset {
width: 100px;
height: 100px;
background: gray;
float: left;
margin-top: 40px;
}
HTML:
<div id="container">
<div id="inset">Inset</div>
This text should wrap all around. This text should wrap all around. This text should wrap all around. This text should wrap all around. This text should wrap all around. This text should wrap all around. This text should wrap all around. This text should wrap all around. This text should wrap all around. This text should wrap all around. This text should wrap all around. This text should wrap all around. This text should wrap all around. This text should wrap all around. This text should wrap all around. This text should wrap all around. This text should wrap all around. This text should wrap all around. This text should wrap all around. This text should wrap all around. This text should wrap all around. This text should wrap all around. This text should wrap all around. This text should wrap all around.
</div>
コンテナがhtmlの最初の子である必要がありますか?それともテキストのどこかに置くことができますか? – Marnix
@Marnix、どこにでも置くことができます。 HTMLはどのような方法でも構成できます。私はちょうど問題を示す最も簡単な例を作ろうとしました。 – cope360