Is there a difference beetwen #1 and #2? I’m thinking about cross browser compatibility and accessibility. Should I prefer one approach to the other or it doesn’t make a difference?
Any link to articles on the subject is welcome.
<div class="tags">
<ul>
<li>tag 1</li>
<li>tag 2</li>
<li>tag 3</li>
</ul>
</div>
<ul class="tags">
<li>tag 1</li>
<li>tag 2</li>
<li>tag 3</li>
</ul>
A div is an empty (semantically meaningless) element until you give it styles and content. Since both divs and uls are both block-level elements by default, it seems like it’s just adding extra code to use a wrapping div. Unless you are trying to do something like, say, style the area around the ul, where you may want a wrapping div with its own styles applied. Is there any particular purpose you have in mind that we may see?