8 basic tags:

The 8 basic html tags

On this page we will look at the tags that are used to create an html document.

Quick Links:
html tag list
html tags
Head tags
Quick Links:
Title tags
Body tags
Basic document

html tags

In html there are 8 basic tags, that are used in every web page/html document, that you see on the internet.
These are listed below.

  1. <html>
  2. <head>
  3. <title>
  4. </title>
  5. </head>
  6. <body>
  7. </body>
  8. </html>

Most of the tags  in html come in pairs and one is an <opening> tag  and the other is the </closing> tag.
There are a few exceptions to this rule though the <br/> tag,  and the <hr/> tag  are both tags  that dont have a closing tag.
The first tag  the <br/> tag,  is a line break tag,  the <hr/> tag,  is a horizontal rule tag  it creates a horizontal line  across the web page like the one below, that is set to 50% width of the page, using the following css style   <hr style="width: 50%;" />

The <html> tags.

The code example below is a basic html file the <html> tags  identify the document to be an html document.
It is mandatory to use these tags  in any html file/document and everything that is between these two tags  is contained within the html file including the header and the body of the file/document.

<html>
<head>
<title>
Sample html Document.
</title>
</head>
<body>
<h1>Sample html Document</h1>
The contents of the document
go here...

</body>
</html>
Top of pageTop of page

You can find more information on the W3Schools web site on html tags.

The <head> tags.

The <head> tags  in an html document can contain information about the document, it can also contain the following tags  <base> <link> <meta> <title> <style> and <script>
None of the information is rendered in the browser apart form the information between the <title> tags.
Start and end tags  are mandatory.

<html>
<head>
<title>
Sample html Document.
</title>
</head>
<body>
<h1>Sample html Document</h1>
The contents of the document
go here...

</body>
</html>
Top of pageTop of page

You can find more information at the W3Schools web site on head tags.

The <title> tags.

The <title> tags  define the documents title and this is displayed in the browsers caption bar a start and end tag  are mandatory.
The title is also used as the default shortcut/favourite name in most browsers and seach engines use it to link to the document.
So you should always include a title for your documents and make the title as descriptive and concise as possible.

<html>
<head>
<title>
Sample html Document.
</title>
</head>
<body>
<h1>Sample html Document</h1>
The contents of the document
go here...

</body>
</html>
Top of pageTop of page

You can find more information here at the W3Schools web site on title tags.

The <body> tags.

The <body> tags  inform the browser that everything that is between these two tags  is to be displayed within the browser window,  when it opens an html document.
The body tags  have various attributes that can be utilised, but in html 4.01 the use of these attributes is discouraged,  meaning that they have effectively been deprecated.
The start and end tags  are mandatory.

<html>
<head>
<title>
Sample html Document.
</title>
</head>
<body>
<h1>Sample html Document</h1>
The contents of the document
go here...

</body>
</html>
Top of pageTop of page

You can find more information at the W3Schools web site on body tags.

Putting it all together

When you put all the tags together you then have a basic html file/document as illustrated by the code below.
To see what this looks like when it is rendered in a browser click on this link Basic document

Downloads:
Download a copy of the basic html file example.
Download a copy of the basic file example
Download the source code in a text file.
Download the source code in a text file
<html>
<head>
<title>
Sample html Document.
</title>
</head>
<body>
<h1>Sample html Document</h1>
<p>
The contents of the document
go here...

</p>
</body>
</html>

All html documents should contain the 8 basic tags  and they must also have a Document Type Declaration (DTD) specification, to inform the browser about the type of html used in the document.
You can find more information here at this page on DTD’s
The rest of the elements are optional, but they do help to define the documents purpose, style, formatting and ultimately it’s usablitily which you will discover as you learn more about html.

Google
 
Top of page
Valid XHTML1.0 Transitional. Valid CSS. Copyright © 2005 –
www.syntaxsandbox.co.uk