Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which is the more correct page layout?

Tags:

html

With the addition of the <main> element in the HTML5 draft spec, which is the more correct page layout?

<body>
    <header> ... </header>
    <main>
        <aside> ... </aside>
    </main>
    <footer> ... </footer>
</body>

or;

<body>
    <header> ... </header>
    <section>
        <main> ... </main>
        <aside> ... </aside>
    </section>
    <footer> ... </footer>
</body>
like image 434
darronz Avatar asked Jan 14 '23 06:01

darronz


1 Answers

The answer as to the correctness of each of the example markup patterns can be found in the normative definition of the main element.

Contexts in which this element can be used: Where flow content is expected, but with no article, aside, footer, header or nav element ancestors. Authors must not include more than one main element in a document.

In this case either example markup is conforming. It is difficult to know which is the most appropriate or practical from a theoretical example alone.

And which spec are the browsers following?

Browsers have implemented the main element as defined in the W3C HTML specification. Conformance checkers such as the W3C HTML validator will implement the conformance requirements of the W3C HTML spec.

Note: The main element will be added to HTML 5.0 in the near future.

Note: The specification of the main element in HTML 5.1 supersedes the extension spec.

like image 173
Steve Faulkner Avatar answered Jan 18 '23 22:01

Steve Faulkner