View Full Version : DIV Width - What am I missing?

05-09-2007, 10:50 AM
Hey guys,

I've done around 15-20 nice CSS sites so far without much trouble. I've just started doing a new one.

I've gotten halfway through and realised my "content" div isn't keeping to it's width like all the previous website have done so.

I even went right down to only having a html page with a "content" div on with only one parameter in the CSS page, like as so:

div.content {width: 200px;}

Putting some text inside the div on the HTML page that was longer than 200px, instead of going down to a new line within 200px, it just extends the div along as far as the text goes.

Have I by chance somehow forgot to learn some basic lesson about div widths here?

05-09-2007, 01:47 PM
Which browser are you viewing the page in? How do you know that the div is expanding and that content is not just overflowing? This you can tell if you apply some background color to the div. You need to show us some code, preferably a link.

With that said, a div in IE6 (and earlier versions) having overflow: visible will incorrectly expand in width if it holds too wide content. Generally you have to take into account Internet Explorer and the Expanding Box Problem (http://www.positioniseverything.net/explorer/expandingboxbug.html)

05-10-2007, 08:03 AM
Hey thanks that makes perfect sense now, obviously something that I haven't come across yet. All in the learning process I guess.