Tuesday, July 24, 2018


HTML Simple Tags

HTML is a markup language and makes use of various tags to format the content. These tags are enclosed within angle braces <Tag Name>. Except few tags, most of the tags have their corresponding closing tags. For example, <html> has its closing tag </html> and <body> tag has its closing tag </body> tag etc.

HTML Tags
HTML tags are element names surrounded by angle brackets:
<tagname>content goes here...</tagname>

HTML tags normally come in pairs like <p> and </p>
The first tag in a pair is the start tag, the second tag is the end tag
The end tag is written like the start tag, but with a forward slash inserted before the tag name

Tip: The start tag is also called the opening tag, and the end tag the closing tag.


Tag                                         Description

<!DOCTYPE>                      Defines the document type
<html>                                   Defines an HTML document
<head>                                   Defines information about the document
<title>                                    Defines a title for the document
<body>                                  Defines the document's body
<h1> to <h6>                        Defines HTML headings
<p>                                        Defines a paragraph


HTML Document Structure

A typical HTML document will have the following structure −

<html>
    
<head>
      Document header related tags
   </head>

   <body>
      Document body related tags
   </body>

   </html>

Output:



We will study all the header and body tags in subsequent chapters, but for now let's see what is document declaration tag.

Note: Only the content inside the <body> section (the white area above) is displayed in a browser.


The <!DOCTYPE> Declaration

The <!DOCTYPE> declaration represents the document type, and helps browsers to display web pages correctly.
It must only appear once, at the top of the page (before any HTML tags).
The <!DOCTYPE> declaration is not case sensitive.
The <!DOCTYPE> declaration for HTML5 is:
<!DOCTYPE html>


A Simple HTML Document

<!DOCTYPE html>
<html>

<head>
<title>Page Title</title>
</head>

<body>
<h1>My first heading</h1>
<p>My first paragraph</p>
</body>

</html>

Output:

0 comments:

Post a Comment

Popular Posts