Hi all,
I am practicing my CSS layout but have come across a problem in that when i write a lot of text on one line it continues into the next div. I would be grateful if someone could tell me why this is happening.
Here is my code
I don’t know many words that are this long i.e. “nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn”
You have to treat unbroken text much the same as if you had put an image in that section that is 600px wide. i.e. just don’t do it . If it was a dynamic environment where you had no control you should be trapping input anyway and truncating as you go.
However, these days you can use “word-wrap:break-word;” to break unbroken text at the boundaries as the modern browsers now support it
Most of the time they are not needed as you could simply have set the footer to clear:both in your example anyway. For the nav you should contain the floats using a mechanism that doesn’t need structural markup such as using overflow:hidden on the ul where visible overflow is not required or alternatively the revised clearfix method.
Thanks for the very informative reply Paul O’B. I was just testing the min-height rule and didn’t realise that if you use unbroken text it would overflow out of the div. I will also correct the other issues that you have pointed out. Thanks once again.