CSS: Clear Text from around a float, but not other floats
I'm working on a web project where I would like to clear text from the right and left side of a div, but give other divs the ability to float along side it. I figured the float attribute was the best way to do this, but the "clear" attribute of CSS only affects other floats, not text.
The result would look something like this (hope you all like ASCII art!)
________________________________________________
| This is a long line of text that is going |
| to wrap around multiple lines. It wiil be |
| ________________ ________________ |
| | First Div | | Secondary Div | |
| | declared in | 开发者_Python百科 |_______________| |
| | previous line| |
| |______________| |
| interrupted by the divs that are declared in |
| the line itself. |
|______________________________________________|
The divs could start anywhere in the line. In this case, let's say the first div was declared at the word "wrap" and the second after "It."
Anyone know of a solution for this?
You need javascript (jQuery) to do something like that.
Not only are the divs being taken out of the flow but space has to be measured and additional divs moved in, if there's room. It could get complicated, fast.
Sorry, No solution for your problem. Div and other block elements can "communicate" only with elements but no with TEXT.
PS. The only solution is to divide text and wrap it with some elements (paragraph for example).
精彩评论