Tuesday, September 04, 2007

The overflow attribute

You know those web sites where the text in a menu or a side column spills out from the space it's supposed to be and overlaps the main content or some other menu of the web page? Isn't it annoying? Surely that was not the web designer's intention. Maybe the designer considered only one browser and didn't really test the web page with another. Or maybe the user has selected a different text size, which made text larger than intended. Whatever the reason, it is a unnecessary problem, especially because there is an work-around for it.

The CSS (from Cascading Style Sheet) standard has the overflow style attribute, which can be used in almost any tag, which controls how to display the content of the tag in case it is larger than the visual area allocated for it. For the problem above, the value for this attribute that interest us is overflow: hidden. By specifying it in the corresponding CSS selector, the designer can ensure that
the text or link or image in that tag will not overflow its area and disturb other contents.

It's certainly a big advantage for a very small price.

Labels: ,

0 Comments:

Post a Comment

<< Home

eXTReMe Tracker