1

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

1 Answer 1

2

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 divs is to help with styling/scripting, you should keep using divs. If it genuinely a way to separate sections of the page, use sections.

Sign up to request clarification or add additional context in comments.

2 Comments

w3fools.com made me delete my answer as is its wont
next time... next time... this question can't be answered too many ways

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.