Fandom

HTML & CSS Wiki

Head

648pages on
this wiki
Add New Page
Comments0 Share


The HTML <head> element contains the page's title and description, and some optional scripts and styles. It is usually placed right after the opening <html> tag and right before the opening <body> tag. <Title> is always inserted first within the head. To apply CSS directly into an HTML document, you must insert the code in the <head> section (or at the very beginning of the <body>) for it to work.

AttributesEdit

HTML 4 attributesEdit

Internationalization attributes lang and dir.

Attribute Value Description
profile URL Specifies some meta data profile location(s), separated by white space. Obsolete in HTML5[1].

HTML5 attributesEdit

UsageEdit

To apply this is an HTML document, use:

<html>
    <head>
        <title>The title</title>
        Head content
    </head>
    <body>
        Body content
    </body>
</html>

To use internal CSS in the <head> tag, use:

<html>
    <head>
        <title>The title</title>
        <style type="text/css">
            h1 {
                background-color:black;
                color:white;
            }
        </style>
    </head>
    <body>
        Body content
    </body>
</html>

Rendering Edit

The <head> element defines document properties, and is by itself not visible.

Typical CSS representation:

head {
    display: none;
}

Coding rules Edit

The <head> element is the first child element of the <html> element. It must contain a <title> element, can contain an <isindex> and an <base> element, and can contain several <script>, <style>, <meta>, <link> and <object> elements.

References Edit

  1. http://dev.w3.org/html5/spec/Overview.html#attr-head-profile

External linksEdit

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.