6

Is it necessary to have a heading of <section> in HTML5 like mentioned here http://blog.whatwg.org/is-not-just-a-semantic

Sometime on a page we have some elements which are related and can be combined in a <section id="semantic name"> instead <div id="semantic name"> But we don't have any Heading for that..

Is it OK to use <section> without having <h1>, <h2>, <h3> inside

Jitendra Vyas
  • 148,487
  • 229
  • 573
  • 852

3 Answers3

6

According to the HTML5 Doctor, you should not use <section> if there is no natural heading for it. Also, they say:

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.

Also, check out this nifty flowchart to decide what element is best to use in your situations.

Damon Bauer
  • 2,718
  • 1
  • 22
  • 35
1

No, it is not required.

You can easily check this by reading the definition of the section element ("should" is not "must") or by validating your HTML.

The W3C validator will report a warning when no heading is used, but a warning is not an error.

Community
  • 1
  • 1
unor
  • 92,415
  • 26
  • 211
  • 360
0

Its only necessary if it wont [validate] (http://validator.w3.org)

The use of section tags is to convey the structure of your content, like a book is split into chapters, paragraphs, etc

If your page is mash of images to look like a magazine cover you may not have a need for adding any sections. You'll most likely still want structure for navigation but that's not done using sections.

I would say any page containing chunks of text (most pages) should use a section tag rather than a div. keep the divs for controlling layout only.

My best advice is to see how your site looks in a text only browser, or other accessible client. It amazing how rubbish most sites are designed for accessibility. My take is that section tags are an attempt to improve that.

Brad
  • 15,186
  • 11
  • 60
  • 74