Reputation: 2016
Since the div element in html5 has no special semantic meaning, and can be used for styling purposes, is an arrangement like this OK?
<section>
<div>
<h2>Some title</h2>
<p>Some text</p>
</div>
<div>
<!-- Other elements such as images, a list and a few paragraphs in here -->
</div>
</section>
The h2 is the heading for the section. I use the div simply as a wrapper, so I can float the header and opening paragraph to the left. The other content will be grouped in the second div, that I will float to the right.
My question is - is this method of separation OK, as I don't want the h2 (being wrapped in the div)to lose its semantic connection with the section.
Upvotes: 1
Views: 586
Reputation: 18870
In your example above, you can simply style the section
element if your section
has semantic meaning. The spec. only says that you should use a div
if the sole purpose of it is for styling.
I've written a bit more about this here: HTML5: Section or Article?
Upvotes: 1