views:

37

answers:

3

Basically I'm converting some template I made into html 5.

Done a little research and tried to create a new element called 'wrapper'.

All works fine cross browser etc, but when it came to validating i got this message:

Line 16, Column 13: Element wrapper not allowed as child of element body in this context. (Suppressing further errors from this subtree.)

Here's a link to a minified version of the code.

http://eosa.co.cc/themes2/html5/sof.html

View the source.

Not sure as to what this means or why it won't validate, any one have any ideas?

A: 

There's no html 5 tag such as "wrapper", but there are "section" etc. Check out this website for a more clean explanation: http://jackosborne.co.uk/articles/html5-wrapper/

Gmoliv
Yea I'm aware of the new elements. Just wasn't 100% sure on whether you could create your own elements which you can but obviously they won't validate.
Daryl
A: 

There is no wrapper element, but you can use div or even body as a wrapper.

Marko Dumic
You are not understanding the question. I'm completely aware that I can use a div but I came across the createElement technique and was curious to why it doesn't validate.
Daryl
It doesn't validate because it is not in the spec. The "createElement technique" is used to force IE to style unknown elements, and as such has nothing to do with the spec.
Marko Dumic
A: 

As pointed out there is no element "wrapper"

what you more than likley thinking of is a wrapper div, witch is used to predefine a wrapper context for you page.

What you want to do is like so:

<!doctype html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <title></title>
        <style>#wrapper { width:100%; height:100%; display:block }</style>
    </head>
    <body>
        <siv id="wrapper">

       </wrapper>
    </body>
</html>

Just a note, This has nothing to do with html5, its available in all HTML versions

Wrappers are mainly used for design purposes and is not compulsory when building web pages, but I would advise you use one so that you can set the best width for your client, and also specifically align your content within the body!

RobertPitt
Yea I'm fully aware of previous HTML tags but i wasnt sure to whether you could create your own tags via document.createElement('tag'); which 'is possible' but was unsure to why it doesnt validate.
Daryl