Thursday, January 13, 2011

The HTML Primer

Here is the code for a very basic xHTML compliant web page. There are a few things to note about the basic HTML page. It consists of two basic parts:

  • The header
  • The body
The header is the space that exists between the <head> and </head> tags. This space is generally used for meta-data information, scripting (such as JavaScript), styling (such as CSS), or linking, or referencing, to external styles or scripts. The header contains no web page content.

The body is the space that exists between the <body> and </body> tags. The body of the web page is used for formatting and displaying the actual web page content. This is where you create your headers, place images, link to other web sites, etc.

Also notice that the header and the body of the web page is nested within the <html> and </html> tags.


<!DOCTYPE html PUBLIC "-//W3C//DTD
XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Untitled
Page</title>
</head>
<body>

    <h1>This is the biggest heading.</h1>
    <h2>This is also a heading.</h2>
    <h3>And this</h3>
    <h4>This also</h4>
    <h5>Even this</h5>
    <h6>And finally, this is the smallest heading.</h6>
   
    This is a line<br />
    with a line break.
   
    <p>This is a paragraph nested within paragraph tags.</p>
       
</body>
</html>




























Some basic HTML components:
In the above code you will see the <title> tag. This specifies the title that will appear in your browsers title bar or the active tab if your browser is tabbed.

The <h1> tag is nothing more than a formatting tag. Headers are great for displaying a title for a specific block of content. Headers range in size from 1, being the largest, to 6, being the smallest.

The <br /> tag is a line break tag. This forces the browser to render everything after the break tag to render on a new line.

The <p> tag is called a paragraph tag. What this does is takes all the HTML inside the <p> and </p> tags and sets it down one blank line above and below any existing content.

I will not explain everything there is to know about HTML here, as you could devote an entire website to explaining HTML. And thankfully, somebody already did:

No comments:

Post a Comment

I Break Code Where code gets done.
ASP.NET | HTML | SQL Server | VB.NET | Request A Topic |