Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Html5 section or not to section?

Tags:

html

I'm learning about HTML5, and honestly I can't say I'm really impressed. Semantics are nice and all, but I think that they introduced new elements with a very thin line between them, and a even thinner line between them and the old divs.

Everything is very clear if you do a generic purpose site, like a blogging engine, news publishing portal, and similar, but web apps... I'm having a lot of dilemmas about new html elements.

Here is my situation. I'm developing an ordering system. On the sellers interface I have 3 columns (inline), which represent the status of the order. When the status is changed element is moved from one column into another (background ajax, and js manipulation).

In Html4 I would use 3 divs and put a heading with a title on top of each one. Elements inside the columns would also be divs.

But what about HTML5? I have been looking at the section element, but I'm not really sure how to use it. Here are the options:

  1. Put everything inside one section - I don't think that is the way to go
  2. Put a section around each of the column divs, and heading inside the section
  3. Replace the divs with sections
  4. Put sections inside column divs

So, which way to go?

EDIT: first of all thanks everyone for your quick replies. In the end I'll probably go with Ian Devlins suggestion, and put each column as section. Anyway, just to point out my dissatisfaction with html5, multiple permitted options aren't always a good thing. I'm afraid what will the html5 web look like in a few years, when we can't fully agree on a simple question like this.

EDIT2: one more thing. I'll ask it here so I don't have to open another question. In addition to these 3 columns I have another div which contains order details, when any of the orders are selected. Should it be an article since its self-contained content, or to use an aside tag?

like image 502
ZolaKt Avatar asked Mar 04 '11 16:03

ZolaKt


People also ask

Should you use sections in HTML?

In HTML, a section is a semantic element for creating standalone sections in a web page. These sections should be made up of related content, like contact information. The section element should only be used if there isn't a more specific element to represent the related content.

Should I use section instead of div?

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." Divs have no meaning in and of themselves and generally are only used for styling purposes as indicated above.

Can I have a section in a section HTML?

Yes, since a website is generally divided into one or more sections, use it as long as you feel it describes the structure.

When should you use a section element?

The section tag is used when requirements of two headers or footers or any other section of documents needed. Section tag grouped the generic block of related contents. The main advantage of the section tag is, it is a semantic element, which describes its meaning to both browser and developer.


1 Answers

div is a perfectly valid HTML5 tag. If the new tags don't make any sense in your project, don't feel forced to use them.

like image 63
madd0 Avatar answered Nov 16 '22 03:11

madd0