Reputation: 949
I am rewriting some of my asp.net MVC projects into html5, and I am getting confused about the <section>
element. When should I use it? The <header>
and <footer>
elements makes sence ofcourse, but I dont really know when to use <section>
. Before I used a main div to wrap all the partial views to a MasterView.
Wouldnt <section>
fit for showing the partial views of a MasterView? I have read some about section and It seems like it should consist of a header and a footer which will be quite tending for a partial view?
The structure for the MasterView would be:
---<header>
------ <nav>
---<section>
------- here goes partial views with their own divs.
---<footer>
Is this a good approach?
Thanks,
James Ford
Upvotes: 1
Views: 822
Reputation: 498904
From the spec:
The section element represents a generic document or application section… The section element is not a generic container element. When an element is needed for styling purposes or as a convenience for scripting, authors are encouraged to use the div element instead.
So, if the main intent of the original div
s is to help with styling/scripting, you should keep using div
s. If it genuinely a way to separate sections of the page, use section
s.
Upvotes: 2