2.5.2 Metadata

posted August 25, 2015

Metadata is data (information) about data. Metadata is content that sets up the presentation or behavior of the rest of the content, or that sets up the relationship of the document with other documents.

The <head> tag contains all the metadata and meta tags - it is the metadata container.

<head>

posted August 25, 2015

The <head> tag is the HTML document's metadata container.

The <head> element can include a title for the document, scripts, styles, meta information, and more.

The following elements can go inside the <head> element:



<html lang="en">

    <head>
        Title of the document
    </head>

    <body>
        The content of the document......
    </body>

</html>
 

href

posted September 1, 2014
The href attribute specifies the URL of the page the link goes to.
If the href attribute is not present, the <a> tag is not a hyperlink. So in some cases HTML elements will not work without attributes.
The <a> tag is used for hyperlinks. Let's say we want to link to google.
You might think <a>google</a> will work? Nope.
You need to use the href attribute in the start tag and you will also need the full url of the link. Below the href attribute and value are highlighted.
        <a href="http://google.com">This text will link to Google</a>
        

id

id

posted September 1, 2014
The id attribute specifies a unique id for an HTML element (the value must be unique within the HTML document).
An id typically occurs once or in unique instances across a website. Whereas a class is applied to elements across the website, so it repeats a number of times.
The id attribute is most used to point to a style in a style sheet, and by JavaScript (via the HTML DOM) to manipulate the element with the specific id.
In the example below, the unique id is "pstyle1". Within the head tag, the internal CSS method is used. The CSS is in between the <style> tags. This tells the paragraph to be red and aligned in the center of the page. Try this W3Schools example.
   
        
        <!DOCTYPE html>
        <html lang="en-US">
            <head>
                <title>This is the title tag</title>
                <style>

               #pstyle1 {
                color: red;
                text-align: center;
                }
                
            </style>
            </head>
            <body>
                <p>My first paragraph.</p>
                <p id="pstyle1">My first paragraph.</p>
            </body>
        </html>

lang

posted September 1, 2014
The id attribute specifies a unique id for an HTML element (the value must be unique within the HTML document).
An id typically occurs once or in unique instances across a website. Whereas a class is applied to elements across the website, so it repeats a number of times.
The id attribute is most used to point to a style in a style sheet, and by JavaScript (via the HTML DOM) to manipulate the element with the specific id.
In the example below, the unique id is "pstyle1". Within the head tag, the internal CSS method is used. The CSS is in between the <style> tags. This tells the paragraph to be red and aligned in the center of the page. Try this W3Schools example.
   
        <!DOCTYPE html>
        <html lang="en-US">
            <head>
                <title>This is the title tag</title>
                <style>

               #pstyle1 {
                color: red;
                text-align: center;
                }
                
            </style>
            </head>
            <body>
                <p>My first paragraph.</p>
                <p id="pstyle1">My first paragraph.</p>
            </body>
        </html>

style

posted September 1, 2014
The style attribute specifies an inline CSS for an element.
The style attribute will override any style set globally, e.g. styles specified in the <style> tag or in an external style sheet.
   
        
        <!DOCTYPE html>
        <html lang="en-US">
            <head>
                <title>This is the title tag</title>
            </head>
            <body>
                <p style="color:green;">This paragraph is important</p>
            </body>
        </html>