4 ms·
>divs are not semantic HTML This is very wrong, divs are as semantic as you want them to be. If you have an element that looks like this: <div> <d
by nnash 14y ago
>divs are not semantic HTML
This is very wrong, divs are as semantic as you want them to be. If you have an element that looks like this:
<div>
<div>
<div><p>Hello World<p></div>
</div>
</div>
Then yeah sure it's not semantic because you have two unnecessary divs holding a paragraph, but if it was just the one div holding a paragraph tag it would be perfectly acceptable in HTML 4.x onwards. The only cases I can see a div being non semantic are the silly example I gave above, self closing divs in HTML (not extensible) and empty divs.
- brianfryer 14y ago> divs are as semantic as you want them to be. Then they are not semantic at all. <div class="content">, <div class="post-title">, <div class="meta-data"> all have semantic CSS class names. But they are not semantic HTML names. Remove the CSS, and all you have is <div>, <div>, and <div>. This makes it difficult for screen readers (and web surfers who don't use CSS (are these people even real?)) to understand what the page is saying. However <article>, <header>, and <aside> all have semantic meaning that can be discerned whether or not CSS is used. Also: Whether or not something validates is not a good indicator of it being "semantic".
- Ingolmo 14y agoYou cannot use ONLY these "meant to be" semantic tags (<article>, <header>, ...) to describe semantically all the content you have. Divs is then the only way to go I know.
- brianfryer 14y agoI'll quote ricardobeat's comment above (http://news.ycombinator.com/item?id=4284877 http://news.ycombinator.com/item?id=4284877): "Not every, but 95% do. For the rest, there are other pssibilities and tools to make sense of it (microdata, ARIA attributes, etc). Just ignoring semantics altogether won't do any better."
- nnash 14y agoYour understanding of semantics is a bit hazy. Conversely to the pull quote you grabbed from me any semantic element can be used in a non-semantic way.
- brianfryer 14y agoI agree I still have much to learn. But I don't let this get in the way of trying to "do things right" :-)