Skip to main content

HTML Basics

HTML Tags, Attributes & Element



Tags :

HTML tags are keyword (tag names) surround by angle brackets :
<tagname>content</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 slash before the tag name.
Attributes :

Tags can also haveattributes, which are extra bits of information. Attributes appear inside the opening tag and their values sit inside qoutation marks. They look somthing like :
<tag attribute="value">Margarine</tag>  


Element : 

Element are the bits that make up web pages.
Example :

<body> The quick brown fox jumps over the 1 azy dog. </body>
 everything that is in between (and includes) <body> and </body> tags is the body element.

Example 2 :  

<tittle>Rumple stiltskin</tittle>
"<tttle>" and "</title> are tags, "<title>Rumple Stiltskin</title>" is a title element 
HTML Tags, Attributes & Element



Tags :

HTML tags are keyword (tag names) surround by angle brackets :
<tagname>content</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 slash before the tag name.
Attributes :

Tags can also haveattributes, which are extra bits of information. Attributes appear inside the opening tag and their values sit inside qoutation marks. They look somthing like :
<tag attribute="value">Margarine</tag>  


Element : 

Element are the bits that make up web pages.
Example :

<body> The quick brown fox jumps over the 1 azy dog. </body>
 everything that is in between (and includes) <body> and </body> tags is the body element.

Example 2 :  

<tittle>Rumple stiltskin</tittle>
"<tttle>" and "</title> are tags, "<title>Rumple Stiltskin</title>" is a title element 

Below are the few essential HTML tags :




Tags
Description
<!DOCTYPE>
This tag defines the document type and HTML version


<html>
This tah encloses the complete HTML document and mainly comprises of document header which is represented by <head>…</head> and document body which is represented By <body>…</body> tags.
<head>
This tag represents the document’s header which can keep other HTML tags like <title>, <link> etc.
<title>
Tag <title> tag is used inside the <head> tag to mention the Document title.
<body>
This tag represents the document’s body which keeps other HTML tag like <h1>, <div>, <p> etc.
<!--…-->
Defines a comment



HTML Document Structure

A typical HTML Document will have following structure :
<--Document declaration tag-->
<html>
        <head>
               Document header related tags
        </head>
               Document body related tags
        </body>
</html>

Write HTML using Notepad (Hello World) 

1. Open Notepad. 
2. Write HTML code.
    Copy and paste the following HTML code into your newly open text file.
    <html>
            <head></head>
            <body>
                    Hello World
            </body>
    </html>
3. Save It.
    Click file, save it with a HTML file extension, e.g.
    "helloworld.html".
4. Demo.
    Double click to view it. (Or open the newly saved HTML file with your favor Internet browser).

Explanation of code

1. <html></html> tag is tell internet browser this file is a start and end of the HTML file document.
2. Text between <head></head> tag is for HTML header information, which is not display in internet  browser   
3. Text between <title></title> will display in left-up corner in internet browser, its web page title.
4. Text between <body></body> will display as content in internet browser. 
  
Below are the few essential HTML tags :



Tags
Description
<!DOCTYPE>
This tag defines the document type and HTML version


<html>
This tah encloses the complete HTML document and mainly comprises of document header which is represented by <head>…</head> and document body which is represented By <body>…</body> tags.
<head>
This tag represents the document’s header which can keep other HTML tags like <title>, <link> etc.
<title>
Tag <title> tag is used inside the <head> tag to mention the Document title.
<body>
This tag represents the document’s body which keeps other HTML tag like <h1>, <div>, <p> etc.
<!--…-->
Defines a comment



HTML Document Structure

A typical HTML document will have following structure :
 <!--Document declaration tag-->
<html>
        <head>
               Document header related tags
        </head>
               Document body related tags
        </body>
</html>

Write HTML Using Notepad (Hello World)

1. Open Notepad. 
2. Write HTML code.
    Copy and paste the following HTML code into your newly open text file.
    <html>
            <head></head>
            <body>
                    Hello World
            </body>
    </html>
3. Save It.
    Click file, save it with a HTML file extension, e.g.
    "helloworld.html".
4. Demo.
    Double click to view it. (Or open the newly saved HTML file with your favor Internet browser).

Explanation of code

1. <html></html> tag is tell internet browser this file is a start and end of the HTML file document.
2. Text between <head></head> tag is for HTML header information, which is not display in internet  browser   
3. Text between <title></title> will display in left-up corner in internet browser, its web page title.
4. Text between <body></body> will display as content in internet browser.
 

Comments