1

What are the differences between sections and divs? both you use as the same:

<div id='test'> Element1 </div>
<section id='test'> Element2 </section>

but what is for what?

and second question: i need to design a homepage... the content page should look like this one... with different parts..what should i take.. divs or sections?

Deduplicator
  • 44,692
  • 7
  • 66
  • 118

4 Answers4

2

From here:

The section element represents a generic document or application section…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. section is a blob of content that you could store as an individual record in a database.

div is a the generic flow container. It is a block-level element with no additional semantic meaning.

Rahul Tripathi
  • 168,305
  • 31
  • 280
  • 331
1

Yes div is the block level element and use as a container but section is a semantic tags in html5 for more better way to representation the html content.

Asraful Haque
  • 1,109
  • 7
  • 17
1

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.

Click Here to know more about DIV

Section :

The section element represents a generic section of a document or application. A section, in this context, is a thematic grouping of content, typically with a heading.

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.

Click here to know more about SECTION

Amarnath Balasubramanian
  • 9,300
  • 8
  • 34
  • 62
1

The section tag is new to HTML5, which effectively means older browsers may have trouble with it. According to MDN

•Do not use the element as a generic container; this is what is for, especially when the sectioning is only for styling purposes. A rule of thumb is that a section should logically appear in the outline of a document.

grassBlade
  • 29
  • 2