This is a discussion on Adding Structure in HTML within the Graphics forums, part of the Tutorials category; A div is used to divide up a web page and, in doing so, to provide a definite structure that ...
A div is used to divide up a web page and, in doing so, to provide a definite structure that can be used to great effect when combined with CSS.
The extraordinary thing about a div is that, normally, it has no result on the styling of the text it contains, except for the fact that it adds a break before and after the contained text. Consider the following markup:
<p>This is a paragraph.</p><p>So is this.</p>
If you were to modify those paragraph tags to divs, there would be very little obvious change in the page’s appearance when you viewed it in a browser (as Figure 2.8 shows).
<p>This is a paragraph.</p><div>This looks like a paragraph, but it's actually a div.</div><p>This is another paragraph.</p><div>This is another div.</div>
Figure 2.8. Paragraphs displaying similarly to divs
“But they look exactly the identical! What’s the diversity between using a div and a p?”, you may protest. Well, the purpose of a div is to divide up a web page into distinct sections, adding structural meaning, whereas p should be used to create a paragraph of text.
Bookmarks