lofidevops
lofidevops

Reputation: 16942

Can I put a <section> inside a <header>?

I have not been able to find a reference describing the relationship between the HTML5 tags header and section (or footer and section). Most examples put p elements inside headers and footers.

Is it both legal and advisable to put a section element into a header?

References:

Upvotes: 5

Views: 6841

Answers (1)

Alohci
Alohci

Reputation: 82976

Yes you can.

Formally, the content model of header elements is

Flow content, but with no header or footer element descendants.

And the contexts in which section elements can be used is

Where sectioning content is expected.

Sectioning content is subset of flow content, so that means anywhere flow content is expected, except places where it's nevertheless explicitly called out as not allowed, which as we see above, it isn't for header.

(The places where it is currently called out as not allowed are as the descendants of an address, dt, and th element.)

Upvotes: 6

Related Questions