Irakli
Irakli

Reputation: 1143

Html5 footer inside div VS div inside footer?

Hi guys, I am creating a web page and I don't know which one is better syntax (I am using Bootstrap CSS framework, if it matters):

<div class="container">
    <div class="row">
        <footer class="span12">
            ...
        </footer>
    </div>
</div>

VS

<footer class="container">
    <div class="row">
        <div class="span12">
            ...
        </div>
    </div>
</footer>

Upvotes: 1

Views: 4137

Answers (1)

feeela
feeela

Reputation: 29932

This doesn't matter from a semantic point of view. A FOOTER element always belongs to "its nearest ancestor sectioning content or sectioning root element."

A DIV isn't a sectioning element, but BODY is (and SECTION too). A DIV does not add any semantics.

You should choose your markup according to your design in that case. The question is, whether you have a footer, that is displayed on the whole width of the screen, with its contents centered or should the footer be centered itself.

From a Bootstrap-point-of-view there is also a third option:

<div class="container">
    <footer class="row">
        <div class="span12">
            ...
        </div>
    </footer>
</div>

That way the footer is the logical row and one may add multiple columns to it.

Upvotes: 1

Related Questions