View Full Version : what can css boxes do?

05-19-2009, 11:56 PM
I am trnsitioning from tables to css boxes for layout. I am wondering if css boxes can do force elements to stay inside the box like tables can.

Right now I have text inside one css box that overflowing out the box completly.


I appreciate any help

05-20-2009, 12:24 AM
Not sure what you mean by 'css boxes'. Do you mean 'div'? That is html, not css.

I'm not on my dev computer but, if the element is floated, elements are never to expand to contain floated elements and you may need to 'clear the float'.

EDIT: Well, it looks like your 'spec' div is set at 400px height and that's why the text overflows. You probably just want to remove that altogether.

05-20-2009, 07:00 AM
Thanks interesting point. The problem that brought this up I am trying to wrap text around another div tag. Currently the text just starts below the other div tag instead of next to it then move its way down.

Thanks a lot for the help

05-20-2009, 11:21 AM
You'd need to use float for displaying two block level elements like <div> in the same line.
Try setting a float:left; and a required width(say width:150px; ) and then a suitable margin-left (in this case margin-left:150px;) to the second one.