Nie mam problemu z pobieraniem tekstu wokół elementu div, gdy wierzchołki elementów są wyrównane, ale nie mogę wymyślić sposobu zawijania tekstu powyżej i poniżej elementu div.Jak zrobić oblewanie tekstem powyżej i poniżej elementu div?
Na przykład chcę, aby tekst był całą szerokością #container dla 40 pikseli, a następnie zawinąć go w prawo, a następnie ponownie przejść do pełnej szerokości.
Zobacz go na http://jsfiddle.net/cope360/wZw7T/1/. Tam, gdzie dodałem górny margines do #inset, chciałbym, żeby tekst się zawijał. czy to możliwe?
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>
Czy pojemnik musi być jak pierwsze dziecko w html? A może umieścisz to gdzieś w tekście? – Marnix
@Marnix, Można go umieścić w dowolnym miejscu. HTML może być zbudowany w dowolny sposób. Po prostu próbowałem zrobić najprostszy przykład, który pokazuje problem. – cope360