tags:

views:

40

answers:

2

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  |       |_______________| |
|     | 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?

A: 

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).

Jenechka
+1  A: 

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.

Brock Adams
That's a shame to hear. I was hoping for this interface but if it can't be done, it can't be done.Thanks!
Jeff
It can be done, it just requires more work than it is probably worth.
Brock Adams
It seems like it can't be done without fixed width, or, say, putting every line or word in a separate div
Jeff