Grow your CSS skills. Land your dream job.

Order of elements in “head” section of html document

  • GMB
    # May 25, 2012 at 11:44 am

    I am wondering if there is a fixed/correct order for elements appearing in the “head” section of an html document. I’m working on a project and often have style and script elements and am not sure if they should appear in that order and before or after the title of the document. The following is typical of this project:



    Is this all right? Should the title precede the style and script? Any help would be appreciated.

    Thanks in advance.

    # May 25, 2012 at 3:48 pm

    I normally do it in this order;
    Meta charset (this should always be before the title)
    Title
    Other meta tags
    Styles

    and move my JavaScript to the end of the document before the closing the body

    # May 25, 2012 at 6:32 pm

    I do the same thing. :)

    GMB
    # May 25, 2012 at 7:13 pm

    Thanks for the comments.

    And if I had a bit o’ script, it would appear just after the JS call before closing the body, like so:



    Right?

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".