What is the difference between <section>
and <div>
in HTML
?
Aren't we defining sections in both cases?
What is the difference between and ?
Asked
Active
Viewed 7.9e+01k times
1151
Roy Bogado
- 4,299
- 1
- 15
- 31
Simplicity
- 47,404
- 98
- 256
- 385
-
2
See also: [Using section element for stylistic layout and wrappers](http://stackoverflow.com/q/18839218/1591669)
– unor
Jan 18 '14 at 15:00
13 Answers
1206
<section>
means that the content inside is grouped (i.e. relates to a single theme), and should appear as an entry in an outline of the page.
<div>
, on the other hand, does not convey any meaning, aside from any found in its class
, lang
and title
attributes.
So no: using a <div>
does not define a section in HTML.
From the spec:
<section>
The <section>
element represents a generic section of a document or application. A section, in this context, is a thematic grouping of content. Each section
should be identified, typically by including a heading (h1-h6 element) as a child of the <section>
element.
Examples of sections would be chapters, the various tabbed pages in a tabbed dialog box, or the numbered sections of a thesis. A Web site’s home page could be split into sections for an introduction, news items, and contact information.
...
The <section>
element is not a generic container element. When an element is needed only for styling purposes or as a convenience for scripting, authors are encouraged to use the <div>
element instead. A general rule is that the <section>
element is appropriate only if the element’s contents would be listed explicitly in the document’s outline.
(https://www.w3.org/TR/html/sections.html#the-section-element)
<div>
The <div>
element has no special meaning at all. It represents its children. It can be used with the class
, lang
, and title
attributes to mark up semantics common to a group of consecutive elements.
Note: Authors are strongly encouraged to view the <div>
element as an element of last resort, for when no other element is suitable. Use of more appropriate elements instead of the <div>
element leads to better accessibility for readers and easier maintainability for authors.
(https://www.w3.org/TR/html/grouping-content.html#the-div-element)
Sections are most relevant in landmark navigation for assistive technology. To appear in the document outline or landmark list, they need a name, which can be assigned by means of aria-label
, aria-labelledby
or title
:
<section aria-labelledby="s3-h2">
<h2 id="s3-h2">Introduction</h2>
…
For example VoiceOver on Mac then can provide an outline to navigate directly to that section.
Andy
- 4,783
- 2
- 26
- 51
Paul D. Waite
- 96,640
- 56
- 199
- 270
-
39
Thinking more about `section` vs. `div`, including in light of this answer, I've come to the conclusion that they are exactly the same element. The W3C says a `div` "represents its children". Well, isn't that also what the `section` element does? Yes, `section` implies its children are grouped together, but by the very act of putting children inside a `div`, you are also, yes, **grouping them together**. At least the way I do it, I don't know about you guys.
– trysis
Aug 05 '14 at 19:11
-
20
@trysis: “Thinking more about `section` vs. `div`” — don’t think too much about it. HTML isn’t complicated. “by the very act of putting children inside a `div`, you are also, yes, **grouping them together**.” Not according to the HTML spec you’re not. You’re wrapping them in a `div` for styling purposes, or JavaScript convenience, or something else that the W3C hasn’t thought of yet, but doesn’t indicate to readers that the child elements are a group.
– Paul D. Waite
Aug 06 '14 at 09:39
-
@trysis: when they say a `` “represents its children” they mean that the `` adds no extra meaning to its children, and in meaning terms should be thought of as entirely interchangeable with its children.
– Paul D. Waite
Aug 22 '14 at 08:21
-
6
+1. imo section, header, footer, nav, div, etc. are all **technically** same. But **semantically**, they all are different.
– musafar006
Dec 05 '15 at 12:39
-
Why does it say: "encouraged to view the div element as an element of last resort"?
– MartianMartian
Jul 08 '16 at 03:07
-
18
@Matian2040: because the purpose of HTML is to add meaning to text, for example `
This is a paragraph
` or `This is a second-level heading
`. Because `` adds no meaning, you’d only use it if there isn’t another HTML element that adds appropriate meaning to the text in question.
– Paul D. Waite
Jul 08 '16 at 09:17
-
9
So there is not a single advantage if using sections? lol, why does it even exist then?!
– Black
Nov 16 '16 at 15:36
-
24
@EdwardBlack: it conveys a different meaning than other tags do. Conveying meaning is the entire point of HTML.
– Paul D. Waite
Nov 16 '16 at 16:05
-
There is a contradiction in each note. I use a few `` for styling purposes, and the first note makes it clear I am correct to use ``. However, the second note makes it clear I should only use `` as a last resort, and its not really a last resort for me to use ``.
– Dan Bray
Jan 08 '17 at 17:32
-
3
@DanBray: “its not really a last resort for me to use ``”— I think what it means by “last resort” is that if there’s any HTML element whose meaning kind of matches your content, you should use that element instead of ``. I don’t think that’s a contradiction in the spec, although if you use `` when your content would be better described by a different element, then you’re not following the spec.
– Paul D. Waite
Jan 09 '17 at 08:27
-
1
-
@John: from my very limited experience of testing with screenreaders and observing screen reader users, I don’t think it would have much practical effect.
– Paul D. Waite
Aug 02 '17 at 07:01
-
3
it to say that the CONTENT is linked. For example, These 3 Paragraphs are do to with "Notes" or "Listed sources". The actual Text you are viewing. (Or for Accessibility sake, The screen reader is reading). on the other hand, Portrays no meaning to the text/content that it is displaying. It could have 3 paragraphs inside the div, but for a screen reader, they are just 3 completely independent paragraphs that happen to sit under a that is colouring the text green, which a blind person couldn't see.
groups content, groups structure. Hope that helps.
– WORMSS
Jan 15 '18 at 14:56
-
1
So is
just about search engine optimization, then? I'm not understanding what the difference would be for the user viewing the page.
– Nightmare Games
Apr 28 '18 at 16:32
-
@NightmareGames: unless browsers (including screen readers) treated the `section` element differently (which I don’t think they do, although I could be wrong), then there would be no difference for users viewing the page. Unless search engines deal with `section` elements differently (which, again, I don’t think they do), then there’s no difference there either.
– Paul D. Waite
Apr 29 '18 at 21:19
-
3
It might be noteworthy that there is also a **technical** difference: https://stackoverflow.com/a/58624781/3744304
– connexo
Oct 30 '19 at 11:58
-
@connexo: If the only technical difference between them is a property that has been marked obsolete, that seems to imply that browsers are not even able to treat them differently. Once the DOM tree is composed, knowledge of what the original tag was is lost. Thus the only benefit (though still an important one) is the semantic meaning that can be used for improving accessibility for visually impaired users, etc. I would assume that accessibility software needs to access the html source of the page.
– John Pankowicz
Jan 24 '20 at 17:43
-
2
I am so inspired by the discussion series above. I am very new to web design. I learned that HTML/CSS/Javascript should belong to a design called separation of concerns. So CSS focuses on styling, javascript focuses on action and reaction, and html focuses on containing information. If you are viewing HTML from the Javascript point of view, you may find many things meaningless just because you are using a wrong perspective. HTML is also a document that we programmers, as human beings, need to manipulate. So giving sufficient semantic tags help enhance readability and should be respected.
– Ken T
Aug 27 '20 at 18:46
-
1
Well put, @KenT. You could say there also is a 4th perspective: The accessibility tree. It’s what users with assistive technology like screen readers use. And semantic HTML is crucial for a useful accessibility tree.
– Andy
Jul 05 '22 at 16:30
89
<section>
marks up a section, <div>
marks up a generic block with no associated semantics.
Quentin
- 914,110
- 126
- 1,211
- 1,335
-
1
@MarwenTrabelsi — The link isn't dead. "Section" is a standard English word. Dictionaries are available.
– Quentin
Oct 18 '19 at 08:33
-
@MarwenTrabelsi — The terms you call "abstract and wide" *are* the key differences.
– Quentin
Oct 18 '19 at 08:54
-
This seems like a more "in your face" kinda answer. And I mean it in a good way. Like no nonsense to the point. Thanks.
– Max
Mar 10 '22 at 15:32
75
Just an observation - haven't found any documentation corroborating this
If a section contains another section, a h1-header in the inner section is displayed in a smaller font than a h1- header in outer section.
When using div instead of section the inner div h1-header is diplayed as h1.
<section>
<h1>Level1</h1>
some text
<section>
<h1>Level2</h1>
some more text
</section>
</section>
-- the Level2 - header is displayed in a smaller font than the Level1 - header.
When using css to color h1 header, the inner h1 were also colored (behaves as regular h1).
It's the same behaviour in Firefox 18, IE 10 and Chrome 28.
David Storfer
- 333
- 3
- 11
runec
- 1,687
- 12
- 22
-
4
How very weird... created a quick stackblitz to demo this as it's still a thing https://stackblitz.com/edit/angular-h1ayez
– Gavin Mannion
Mar 04 '20 at 16:56
-
Exactly like sections in Latex language, it's called subsection there.
– SdSaati
Sep 01 '20 at 16:21
-
1
The MDN docs make mention of avoiding multiple h1's in a single page, even though it's technically supported. I imagine that's the bug (?) that results in the strange styling of h1's nested in sections.
In the demo posted by @GavinMannion (thanks), you will note that all the h2's are styled the same, no matter the level of nesting within sections. TLDR, h1's are treated differently, and sections should only start with h2's rather than h1.
– Alan
Nov 21 '20 at 02:32
-
@GavinMannion: Nice example. Interestingly, it does not have any affect on `
` elements... i.e all `` are rendered in the same font-size. Wow! Amazing!
– Nawaz
Jun 28 '22 at 23:07
69
<div> Vs <Section>
Round 1
<div>:
The HTML element (or HTML Document Division Element) is the generic container for flow content, which does not inherently represent anything. It can be used to group elements for styling purposes (using the class or id attributes), or because they share attribute values, such as lang. It should be used only when no other semantic element (such as <article>
or <nav>
) is appropriate.
<section>:
The HTML Section element (<section>
) represents a generic section of a document, i.e., a thematic grouping of content, typically with a heading.
Round 2
<div>:
Browser Support

<section>:
Browser Support
The numbers in the table specifies the first browser version that fully supports the element.

In that vein, a div is relevant only from a pure CSS or DOM perspective, whereas a section is relevant also for semantics and, in a near future, for indexing by search engines.
Subodh Ghulaxe
- 18,333
- 14
- 83
- 102
-
11
Browser support is a non-issue here, it's about semantics. If you're using HTML5, you'll probably use a polyfill anyway.
– Jack
Sep 19 '14 at 21:22
-
41
In the HTML5 standard, the <section>
element is defined as a block of related elements.
The <div>
element is defined as a block of children elements.
cf-
- 8,598
- 9
- 36
- 58
srikanth_k
- 2,807
- 3
- 16
- 18
-
1
I dont know why someone marked this down. Short, sweet, and too the point.
– user6031759
Jun 21 '16 at 14:39
-
1
-1 it's don't make any sense, how you want to group related elements in the hierarchical structure document (XML/HTML), you can only group block of children elements using any tag.
– Svisstack
Feb 24 '18 at 21:34
-
@Svisstack You are correct that any enclosing tag (ie. not self-closing/void) can group blocks of child elements. Though I think this is getting more into what is the relation of the children. Do they all have a related context to convey? For example: a form containing several inputs would be grouped together for functionality/styling reasons. But this form is not a section of the website, but instead a piece with a function. Now lets say your page was describing a product. Different parts about the product would be listed in a section element because the elements convey a collective idea.
– Xandor
May 27 '19 at 16:58
26
Take caution not to overuse the section tag as a replacement for a div element. A section tag should define a significant region within the context of the body. Semantically, HTML5 encourages us to define our document as follows:
<html>
<head></head>
<body>
<header></header>
<section>
<h1></h1>
<div>
<span></span>
</div>
<div></div>
</section>
<footer></footer>
</body>
</html>
This strategy allows web robots and automated screen readers to better understand the flow of your content. This markup clearly defines where your major page content is contained. Of course, headers and footers are often common across hundreds if not thousands of pages within a website. The section tag should be limited to explain where the unique content is contained. Within the section tag, we should then continue to markup and control the content with HTML tags which are lower in the hierarchy, like h1, div, span, etc.
In most simple pages, there should only be a single section tag, not multiple ones. Please also consider also that there are other interesting HTML5 tags which are similar to section. Consider using article, summary, aside and others within your document flow. As you can see, these tags further enhance our ability to define the major regions of the HTML document.
KoolWebDezign
- 261
- 3
- 2
-
"In most simple pages, there should only be a single section tag". Can you give a non-simple example where you would want to use multiple section tags in a single page?
– styfle
Jun 22 '17 at 14:54
-
10
I would use the `main` tag in there, and inside it, one or more `section` tags.
– Chazy Chaz
Jul 03 '17 at 21:50
-
2
If you follow the spec, your `section` should be `main`, the `div` should be `article` and the `span` would likely be `section` (depending on what it's doing)
– Tom B
Oct 19 '20 at 09:19
14
<div>
—the generic flow container we all know and love. It’s a block-level element with no additional semantic meaning (W3C:Markup, WhatWG)
<section>
—a generic document or application section. A normally has a heading (title) and maybe a footer too. It’s a chunk of related content, like a subsection of a long article, a major part of the page (eg the news section on the homepage), or a page in a webapp’s tabbed interface. (W3C:Markup, WhatWG)
My suggestion:
div: used lower version( i think 4.01 to still) html element(lot of designers handled that).
section: recently comming (html5) html element.
Paul D. Waite
- 96,640
- 56
- 199
- 270
anglimasS
- 1,304
- 2
- 16
- 41
12
Using <section>
may be neater, help screen readers and SEO while <div>
is smaller in bytes and quicker to type
Overall very little difference.
Also, would not recommend putting <section>
in a <section>
, instead place a <div>
inside a <section>
drooh
- 578
- 4
- 18
- 46
9
The section tag provides a more semantic syntax for html. div is a generic tag for a section.
When you use section tag for appropriate content, it can be used for search engine optimization also. section tag also makes it easy for html parsing. for more info, refer. http://blog.whatwg.org/is-not-just-a-semantic
Poomalairaj
- 4,888
- 3
- 23
- 27
-
1
“section tag also makes it easy for html parsing” — eh? Do you mean for generating an outline of the page?
– Paul D. Waite
Aug 04 '11 at 12:14
3
<section></section>
The HTML <section>
element represents a generic section of a
document, i.e., a thematic grouping of content, typically with a
heading. Each <section>
should be identified, typically by including
a heading (<h1>
-<h6>
element) as a child of the <section>
element. For Details Please following link.
References :
- http://www.w3schools.com/tags/tag_section.asp
- https://developer.mozilla.org/en/docs/Web/HTML/Element/section
<div></div>
The HTML <div>
element (or HTML Document Division Element) is the
generic container for flow content, which does not inherently
represent anything. It can be used to group elements for styling
purposes (using the class or id attributes), or because they share
attribute values, such as lang. It should be used only when no other
semantic element (such as <article>
or <nav>
) is appropriate.
References:
- http://www.w3schools.com/tags/tag_div.asp
- https://developer.mozilla.org/en/docs/Web/HTML/Element/div
Here are some links that discuss more about the differences between them:
Ashwin Krishnamurthy
- 3,750
- 3
- 27
- 49
Asad Ali
- 395
- 6
- 23
3
Many web sites contain HTML code like: <div id="nav"> <div class="header"> <div id="footer">
to indicate navigation, header, and footer. So <div>
was used to define different parts of a web page in html4 but <div>
doesn't mean anything particular therefore html5 introduced many semantic elements <section>
is one of them which give enough information to screen readers, search engines and browsers etc, to identify the different part of websites.
the main difference is if you use only <div>
to define website parts. it's less readable.
if you use semantic elements instead of div tag. they can help to improve readability of your website not only to humans for other programs(screen reader, search engine etc) also. we still can use <div>
inside semantic elements as a container.
Bala
- 461
- 7
- 16
1
The <section>
tag defines sections in a document, such as chapters, headers, footers, or any other sections of the document.
whereas:
The <div>
tag defines a division or a section in an HTML document.
The <div>
tag is used to group block-elements to format them with CSS.
-
2
Headers, footers and other sections of the document have their own semantic tags. (`
`, `
– Oliver
Feb 16 '17 at 00:52
0
First, it's important to note that both tags, <div>
and <section>
, are used in web pages.
The <section>
tag itself is not a generic container in a web page, and it basically indicates that the content inside the tag is grouped. The <section>
tag can mainly be used for content with headers, footers, or any other section of a web page that may need to be placed inside a section.
To give you a concrete example, the homepage of a website can be divided into several different sections, such as About Us, News, Contact Information, etc.)
Below is an HTML example of how a <section>
tag can be used.
<!DOCTYPE html>
<html>
<head>
<title>The section tag</title>
</head>
<body>
<h1>Animals</h1>
<section>
<h2>Rainforest Animals</h2>
<ul>
<li>Jaguar</li>
<li>Green Anaconda</li>
<li>Okapi</li>
<li>Capybara</li>
<li>Leopard</li>
</ul>
</section>
</body>
</html>
On the other hand, the <div>
tag, also known as the division tag, is one of the most commonly used HTML tags. It serves as a block-level element of a web page that represents its child elements and is usually used with the title and class attributes - for styling purposes or for wrapping paragraphs, in a section whose content is meant to be assigned similar properties.
Below is an HTML example of how a tag can be used.
<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
<style>
.myDiv
{
border: 6px outset lightgreen;
background-color: black;
text-align: center;
color: white;
}
</style>
</head>
<center> <h1>Animals</h1> </center>
<div class="myDiv">
<h2>Rainforest Animals</h2>
<p>Animals are amazing creatures.</p>
</div>
</body>
</html>
Patrick Cyubahiro
- 81
- 5

- 4,299
- 1
- 15
- 31

- 47,404
- 98
- 256
- 385
-
2See also: [Using section element for stylistic layout and wrappers](http://stackoverflow.com/q/18839218/1591669) – unor Jan 18 '14 at 15:00
13 Answers
<section>
means that the content inside is grouped (i.e. relates to a single theme), and should appear as an entry in an outline of the page.
<div>
, on the other hand, does not convey any meaning, aside from any found in its class
, lang
and title
attributes.
So no: using a <div>
does not define a section in HTML.
From the spec:
<section>
The
<section>
element represents a generic section of a document or application. A section, in this context, is a thematic grouping of content. Eachsection
should be identified, typically by including a heading (h1-h6 element) as a child of the<section>
element.Examples of sections would be chapters, the various tabbed pages in a tabbed dialog box, or the numbered sections of a thesis. A Web site’s home page could be split into sections for an introduction, news items, and contact information.
...
The
<section>
element is not a generic container element. When an element is needed only for styling purposes or as a convenience for scripting, authors are encouraged to use the<div>
element instead. A general rule is that the<section>
element is appropriate only if the element’s contents would be listed explicitly in the document’s outline.
(https://www.w3.org/TR/html/sections.html#the-section-element)
<div>
The
<div>
element has no special meaning at all. It represents its children. It can be used with theclass
,lang
, andtitle
attributes to mark up semantics common to a group of consecutive elements.Note: Authors are strongly encouraged to view the
<div>
element as an element of last resort, for when no other element is suitable. Use of more appropriate elements instead of the<div>
element leads to better accessibility for readers and easier maintainability for authors.
(https://www.w3.org/TR/html/grouping-content.html#the-div-element)
Sections are most relevant in landmark navigation for assistive technology. To appear in the document outline or landmark list, they need a name, which can be assigned by means of aria-label
, aria-labelledby
or title
:
<section aria-labelledby="s3-h2">
<h2 id="s3-h2">Introduction</h2>
…
For example VoiceOver on Mac then can provide an outline to navigate directly to that section.

- 4,783
- 2
- 26
- 51

- 96,640
- 56
- 199
- 270
-
39Thinking more about `section` vs. `div`, including in light of this answer, I've come to the conclusion that they are exactly the same element. The W3C says a `div` "represents its children". Well, isn't that also what the `section` element does? Yes, `section` implies its children are grouped together, but by the very act of putting children inside a `div`, you are also, yes, **grouping them together**. At least the way I do it, I don't know about you guys. – trysis Aug 05 '14 at 19:11
-
20@trysis: “Thinking more about `section` vs. `div`” — don’t think too much about it. HTML isn’t complicated. “by the very act of putting children inside a `div`, you are also, yes, **grouping them together**.” Not according to the HTML spec you’re not. You’re wrapping them in a `div` for styling purposes, or JavaScript convenience, or something else that the W3C hasn’t thought of yet, but doesn’t indicate to readers that the child elements are a group. – Paul D. Waite Aug 06 '14 at 09:39
-
@trysis: when they say a `` “represents its children” they mean that the `– Paul D. Waite Aug 22 '14 at 08:21` adds no extra meaning to its children, and in meaning terms should be thought of as entirely interchangeable with its children.
-
6+1. imo section, header, footer, nav, div, etc. are all **technically** same. But **semantically**, they all are different. – musafar006 Dec 05 '15 at 12:39
-
Why does it say: "encouraged to view the div element as an element of last resort"? – MartianMartian Jul 08 '16 at 03:07
-
18@Matian2040: because the purpose of HTML is to add meaning to text, for example `
This is a paragraph
` or `This is a second-level heading
`. Because `` adds no meaning, you’d only use it if there isn’t another HTML element that adds appropriate meaning to the text in question.– Paul D. Waite Jul 08 '16 at 09:17 -
9So there is not a single advantage if using sections? lol, why does it even exist then?! – Black Nov 16 '16 at 15:36
-
24@EdwardBlack: it conveys a different meaning than other tags do. Conveying meaning is the entire point of HTML. – Paul D. Waite Nov 16 '16 at 16:05
-
There is a contradiction in each note. I use a few `` for styling purposes, and the first note makes it clear I am correct to use `– Dan Bray Jan 08 '17 at 17:32`. However, the second note makes it clear I should only use `` as a last resort, and its not really a last resort for me to use ``.
-
3@DanBray: “its not really a last resort for me to use ``”— I think what it means by “last resort” is that if there’s any HTML element whose meaning kind of matches your content, you should use that element instead of `– Paul D. Waite Jan 09 '17 at 08:27`. I don’t think that’s a contradiction in the spec, although if you use `` when your content would be better described by a different element, then you’re not following the spec.
-
1
-
@John: from my very limited experience of testing with screenreaders and observing screen reader users, I don’t think it would have much practical effect. – Paul D. Waite Aug 02 '17 at 07:01
-
3it to say that the CONTENT is linked. For example, These 3 Paragraphs are do to with "Notes" or "Listed sources". The actual Text you are viewing. (Or for Accessibility sake, The screen reader is reading).on the other hand, Portrays no meaning to the text/content that it is displaying. It could have 3 paragraphs inside the div, but for a screen reader, they are just 3 completely independent paragraphs that happen to sit under a– WORMSS Jan 15 '18 at 14:56that is colouring the text green, which a blind person couldn't see.
groups content, groups structure. Hope that helps. -
1So is
just about search engine optimization, then? I'm not understanding what the difference would be for the user viewing the page. – Nightmare Games Apr 28 '18 at 16:32 -
@NightmareGames: unless browsers (including screen readers) treated the `section` element differently (which I don’t think they do, although I could be wrong), then there would be no difference for users viewing the page. Unless search engines deal with `section` elements differently (which, again, I don’t think they do), then there’s no difference there either. – Paul D. Waite Apr 29 '18 at 21:19
-
3It might be noteworthy that there is also a **technical** difference: https://stackoverflow.com/a/58624781/3744304 – connexo Oct 30 '19 at 11:58
-
@connexo: If the only technical difference between them is a property that has been marked obsolete, that seems to imply that browsers are not even able to treat them differently. Once the DOM tree is composed, knowledge of what the original tag was is lost. Thus the only benefit (though still an important one) is the semantic meaning that can be used for improving accessibility for visually impaired users, etc. I would assume that accessibility software needs to access the html source of the page. – John Pankowicz Jan 24 '20 at 17:43
-
2I am so inspired by the discussion series above. I am very new to web design. I learned that HTML/CSS/Javascript should belong to a design called separation of concerns. So CSS focuses on styling, javascript focuses on action and reaction, and html focuses on containing information. If you are viewing HTML from the Javascript point of view, you may find many things meaningless just because you are using a wrong perspective. HTML is also a document that we programmers, as human beings, need to manipulate. So giving sufficient semantic tags help enhance readability and should be respected. – Ken T Aug 27 '20 at 18:46
-
1Well put, @KenT. You could say there also is a 4th perspective: The accessibility tree. It’s what users with assistive technology like screen readers use. And semantic HTML is crucial for a useful accessibility tree. – Andy Jul 05 '22 at 16:30
<section>
marks up a section, <div>
marks up a generic block with no associated semantics.

- 914,110
- 126
- 1,211
- 1,335
-
1@MarwenTrabelsi — The link isn't dead. "Section" is a standard English word. Dictionaries are available. – Quentin Oct 18 '19 at 08:33
-
@MarwenTrabelsi — The terms you call "abstract and wide" *are* the key differences. – Quentin Oct 18 '19 at 08:54
-
This seems like a more "in your face" kinda answer. And I mean it in a good way. Like no nonsense to the point. Thanks. – Max Mar 10 '22 at 15:32
Just an observation - haven't found any documentation corroborating this
If a section contains another section, a h1-header in the inner section is displayed in a smaller font than a h1- header in outer section. When using div instead of section the inner div h1-header is diplayed as h1.
<section>
<h1>Level1</h1>
some text
<section>
<h1>Level2</h1>
some more text
</section>
</section>
-- the Level2 - header is displayed in a smaller font than the Level1 - header.
When using css to color h1 header, the inner h1 were also colored (behaves as regular h1). It's the same behaviour in Firefox 18, IE 10 and Chrome 28.

- 333
- 3
- 11

- 1,687
- 12
- 22
-
4How very weird... created a quick stackblitz to demo this as it's still a thing https://stackblitz.com/edit/angular-h1ayez – Gavin Mannion Mar 04 '20 at 16:56
-
Exactly like sections in Latex language, it's called subsection there. – SdSaati Sep 01 '20 at 16:21
-
1The MDN docs make mention of avoiding multiple h1's in a single page, even though it's technically supported. I imagine that's the bug (?) that results in the strange styling of h1's nested in sections. In the demo posted by @GavinMannion (thanks), you will note that all the h2's are styled the same, no matter the level of nesting within sections. TLDR, h1's are treated differently, and sections should only start with h2's rather than h1. – Alan Nov 21 '20 at 02:32
-
@GavinMannion: Nice example. Interestingly, it does not have any affect on `
` elements... i.e all `
– Nawaz Jun 28 '22 at 23:07` are rendered in the same font-size. Wow! Amazing!
<div> Vs <Section>
Round 1
<div>:
The HTML element (or HTML Document Division Element) is the generic container for flow content, which does not inherently represent anything. It can be used to group elements for styling purposes (using the class or id attributes), or because they share attribute values, such as lang. It should be used only when no other semantic element (such as <article>
or <nav>
) is appropriate.
<section>:
The HTML Section element (<section>
) represents a generic section of a document, i.e., a thematic grouping of content, typically with a heading.
Round 2
<div>:
Browser Support
<section>:
Browser Support
The numbers in the table specifies the first browser version that fully supports the element.
In that vein, a div is relevant only from a pure CSS or DOM perspective, whereas a section is relevant also for semantics and, in a near future, for indexing by search engines.

- 18,333
- 14
- 83
- 102
-
11Browser support is a non-issue here, it's about semantics. If you're using HTML5, you'll probably use a polyfill anyway. – Jack Sep 19 '14 at 21:22
-
In the HTML5 standard, the <section>
element is defined as a block of related elements.
The <div>
element is defined as a block of children elements.

- 8,598
- 9
- 36
- 58

- 2,807
- 3
- 16
- 18
-
1I dont know why someone marked this down. Short, sweet, and too the point. – user6031759 Jun 21 '16 at 14:39
-
1-1 it's don't make any sense, how you want to group related elements in the hierarchical structure document (XML/HTML), you can only group block of children elements using any tag. – Svisstack Feb 24 '18 at 21:34
-
@Svisstack You are correct that any enclosing tag (ie. not self-closing/void) can group blocks of child elements. Though I think this is getting more into what is the relation of the children. Do they all have a related context to convey? For example: a form containing several inputs would be grouped together for functionality/styling reasons. But this form is not a section of the website, but instead a piece with a function. Now lets say your page was describing a product. Different parts about the product would be listed in a section element because the elements convey a collective idea. – Xandor May 27 '19 at 16:58
Take caution not to overuse the section tag as a replacement for a div element. A section tag should define a significant region within the context of the body. Semantically, HTML5 encourages us to define our document as follows:
<html>
<head></head>
<body>
<header></header>
<section>
<h1></h1>
<div>
<span></span>
</div>
<div></div>
</section>
<footer></footer>
</body>
</html>
This strategy allows web robots and automated screen readers to better understand the flow of your content. This markup clearly defines where your major page content is contained. Of course, headers and footers are often common across hundreds if not thousands of pages within a website. The section tag should be limited to explain where the unique content is contained. Within the section tag, we should then continue to markup and control the content with HTML tags which are lower in the hierarchy, like h1, div, span, etc.
In most simple pages, there should only be a single section tag, not multiple ones. Please also consider also that there are other interesting HTML5 tags which are similar to section. Consider using article, summary, aside and others within your document flow. As you can see, these tags further enhance our ability to define the major regions of the HTML document.

- 261
- 3
- 2
-
"In most simple pages, there should only be a single section tag". Can you give a non-simple example where you would want to use multiple section tags in a single page? – styfle Jun 22 '17 at 14:54
-
10I would use the `main` tag in there, and inside it, one or more `section` tags. – Chazy Chaz Jul 03 '17 at 21:50
-
2If you follow the spec, your `section` should be `main`, the `div` should be `article` and the `span` would likely be `section` (depending on what it's doing) – Tom B Oct 19 '20 at 09:19
<div>
—the generic flow container we all know and love. It’s a block-level element with no additional semantic meaning (W3C:Markup, WhatWG)
<section>
—a generic document or application section. A normally has a heading (title) and maybe a footer too. It’s a chunk of related content, like a subsection of a long article, a major part of the page (eg the news section on the homepage), or a page in a webapp’s tabbed interface. (W3C:Markup, WhatWG)
My suggestion: div: used lower version( i think 4.01 to still) html element(lot of designers handled that). section: recently comming (html5) html element.

- 96,640
- 56
- 199
- 270

- 1,304
- 2
- 16
- 41
Using <section>
may be neater, help screen readers and SEO while <div>
is smaller in bytes and quicker to type
Overall very little difference.
Also, would not recommend putting <section>
in a <section>
, instead place a <div>
inside a <section>

- 578
- 4
- 18
- 46
The section tag provides a more semantic syntax for html. div is a generic tag for a section. When you use section tag for appropriate content, it can be used for search engine optimization also. section tag also makes it easy for html parsing. for more info, refer. http://blog.whatwg.org/is-not-just-a-semantic

- 4,888
- 3
- 23
- 27
-
1“section tag also makes it easy for html parsing” — eh? Do you mean for generating an outline of the page? – Paul D. Waite Aug 04 '11 at 12:14
<section></section>
The HTML
<section>
element represents a generic section of a document, i.e., a thematic grouping of content, typically with a heading. Each<section>
should be identified, typically by including a heading (<h1>
-<h6>
element) as a child of the<section>
element. For Details Please following link.
References :
- http://www.w3schools.com/tags/tag_section.asp
- https://developer.mozilla.org/en/docs/Web/HTML/Element/section
<div></div>
The HTML
<div>
element (or HTML Document Division Element) is the generic container for flow content, which does not inherently represent anything. It can be used to group elements for styling purposes (using the class or id attributes), or because they share attribute values, such as lang. It should be used only when no other semantic element (such as<article>
or<nav>
) is appropriate.
References: - http://www.w3schools.com/tags/tag_div.asp - https://developer.mozilla.org/en/docs/Web/HTML/Element/div
Here are some links that discuss more about the differences between them:

- 3,750
- 3
- 27
- 49

- 395
- 6
- 23
Many web sites contain HTML code like: <div id="nav"> <div class="header"> <div id="footer">
to indicate navigation, header, and footer. So <div>
was used to define different parts of a web page in html4 but <div>
doesn't mean anything particular therefore html5 introduced many semantic elements <section>
is one of them which give enough information to screen readers, search engines and browsers etc, to identify the different part of websites.
the main difference is if you use only <div>
to define website parts. it's less readable.
if you use semantic elements instead of div tag. they can help to improve readability of your website not only to humans for other programs(screen reader, search engine etc) also. we still can use <div>
inside semantic elements as a container.

- 461
- 7
- 16
The <section>
tag defines sections in a document, such as chapters, headers, footers, or any other sections of the document.
whereas:
The <div>
tag defines a division or a section in an HTML document.
The <div>
tag is used to group block-elements to format them with CSS.
-
2Headers, footers and other sections of the document have their own semantic tags. (`
`, ` – Oliver Feb 16 '17 at 00:52
First, it's important to note that both tags, <div>
and <section>
, are used in web pages.
The <section>
tag itself is not a generic container in a web page, and it basically indicates that the content inside the tag is grouped. The <section>
tag can mainly be used for content with headers, footers, or any other section of a web page that may need to be placed inside a section.
To give you a concrete example, the homepage of a website can be divided into several different sections, such as About Us, News, Contact Information, etc.)
Below is an HTML example of how a <section>
tag can be used.
<!DOCTYPE html>
<html>
<head>
<title>The section tag</title>
</head>
<body>
<h1>Animals</h1>
<section>
<h2>Rainforest Animals</h2>
<ul>
<li>Jaguar</li>
<li>Green Anaconda</li>
<li>Okapi</li>
<li>Capybara</li>
<li>Leopard</li>
</ul>
</section>
</body>
</html>
On the other hand, the <div>
tag, also known as the division tag, is one of the most commonly used HTML tags. It serves as a block-level element of a web page that represents its child elements and is usually used with the title and class attributes - for styling purposes or for wrapping paragraphs, in a section whose content is meant to be assigned similar properties.
Below is an HTML example of how a tag can be used.
<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
<style>
.myDiv
{
border: 6px outset lightgreen;
background-color: black;
text-align: center;
color: white;
}
</style>
</head>
<center> <h1>Animals</h1> </center>
<div class="myDiv">
<h2>Rainforest Animals</h2>
<p>Animals are amazing creatures.</p>
</div>
</body>
</html>

- 81
- 5