[whatwg] header body footer
Mat Carey
mat at matcarey.co.uk
Sat Nov 10 01:04:09 PST 2012
Unfortunately that's not in-keeping with the backwards compatible nature of HTML5, if we were to specify that as the parsing approach from now on it would cause a major inconvenience to anyone actually trying to use that feature when some browsers have picked it up and others haven't.
> The only issue is the css styling of <body> as <body> is treated as the parent of <header> and <footer>.
This is by design. A body element will wrap the body in the DOM even if there's no body tag in the markup, AFAIK this is partially to document the existing behaviour of not-so-modern browsers (which, of course, we have no influence over); just have a look at how the DOM is structured in the modern browser of your choice - in my case Chrome:
<html><head>
<title>header and footer outside body</title>
<style>
body {border:1em solid #7f2424;}
header {border:1em solid #247f24;}
footer {border:1em solid #24247f;}
</style>
</head> <!-- I wish the <head></head> tags was called <meta></meta> instead. -->
<body><header>
This is the header of the document!
</header>
This is the main content of the document!
<footer>
This is the footer of the document!
</footer>
</body></html>
This feature would be a U-Turn in HTML5 and I can't see any browser vendors going for implementing it at risk of 'breaking the web' … and I agree that there is a major risk of that.
Mat Carey
--
Web Developer & Consultant
mat at matcarey.co.uk
www.matcarey.co.uk
On 9 Nov 2012, at 20:04, Roger Hågensen <rescator at emsai.net> wrote:
> Starting a new subject on this to keep the email threads more clear:
>
> Suggestion is that the following should be possible,
> this would allow <body> to act as if it was a <main>.
>
> <!doctype html>
> <html>
> <head>
> <title>header and footer outside body</title>
> <style>
> body {border:1em solid #7f2424;}
> header {border:1em solid #247f24;}
> footer {border:1em solid #24247f;}
> </style>
> </head> <!-- I wish the <head></head> tags was called <meta></meta> instead. -->
> <header>
> This is the header of the document!
> </header>
> <body>
> This is the main content of the document!
> </body>
> <footer>
> This is the footer of the document!
> </footer>
> </html>
>
>
> As can be seen in most modern browsers. Semantically the content appear correctly.
> The only issue is the css styling of <body> as <body> is treated as the parent of <header> and <footer>.
> I'm not sure how much work or not it would be to allow 1 <header></header> and 1 <footer></footer> outside <body> and let those have <html> as their parent instead,
> but if it's not too much work then this could "fix" the lack of a <main>, and it would avoid the need of using a extra <div> or similar inside <body> just for styling.
>
> Any other pros (or cons)?
>
>
> --
> Roger "Rescator" Hågensen.
> Freelancer - http://www.EmSai.net/
>
More information about the whatwg
mailing list