Monday, October 4, 2010

Divisions (Divs) in Css

Divisions—<div> elements, widely referred to as divs—are (X)HTML elements used to define
areas of an (X)HTML file. A division can, if you choose, encompass everything else within the
<body> of the page, be it additional elements, text, graphics—anything in fact, or more typically
be used for distinct areas such as headers, footers, navigation bars, and so on.
Most often, the (X)HTML in your templates does not provide enough hooks upon which to
hang your styles. For example, you know how to apply basic styling to a paragraph or header,
but turn paragraphs or headers into boxes, and you’ll find it impossible to enclose other (X)HTML
elements inside the box without compromising your code and causing extreme complications.
This is where divisions (I’ll refer to them mostly as divs from now on) are most useful—
invaluable in fact. Using divs is not unlike magically inventing your own (X)HTML tags, whenever
and wherever you need them.

No comments:

Post a Comment