Quote:
|
Originally Posted by maxlobovsky
Jonathan, I'm not sure what you mean by "overuse" of divs and spans. What is overuse? Obviously don't make a page more complicated than you need to display how you want it to, but, if I'm not mistaken, divs and spans are what you are intended to use for positioning in a webpage. Use them (in your CSS, of course) till you get the appearance you like. Correct?
|
Well, what happens in some cases (and I'm a little bit guilty of this on my team's site) is web authors use divs just to change styles in specific areas, for example to change the font of some selection of text, or to position a paragraph just right
when they could have styled another element. Semantically, this is incorrect, as simply enclosing some text in a div and id'ing the div doesn't always
mean anything, and is often just an easier way of achieving a look. The way I justify doing that is if the task is impossible, or silly to do "properly", I'll just use a div or span. These are minor infractions.
The true
overuse of spans and divs occurs when webdesigners try such presentational things as try to nest them within each other to get rounded corners as background-images for example. Sometimes, instead of defining a paragraph as display: block, they'll enclose it in a div which is by default block-level (which means, basically, it's shaped like a block and doesn't flow around other elements like text does). Sometimes they'll use CSS selectors to define rules around any span in an element
Code:
p span { font-size:larger; }
instead of simple
<big> tags, etc.