Summary -
In this topic, we described about the tag along with detailed example.
HTML tags are nothing but keywords. The representation of the tag names is always surrounded by angle brackets like below.
Syntax -
<tagname>content</tagname>
- HTML tags come in pairs.
- In the pair, first tag is start tag and second one is end tag.
- The end tag is written like the start tag, but with a slash before the tag name.
Let us discuss about simple HTML document creation with example.
Example -
<!DOCTYPE html>
<html>
<head>
<title>HTML Simple Example</title>
</head>
<body>
<h1>HTML Heading</h1>
<p>HTML Document content </p>
</body>
</html>
Save the above document as test.html or test.htm
Once it is saved with .htm extension, open the document to view the output. the output for the above look like below.
Saving the document with .html/.htm extension is important to create the html document. If the document doesn’t save it with extension, then the output doesn’t appear on web page. Below list of the tags are minimum required to create a simple webpage.
Tag | Description |
---|---|
<!DOCTYPE...> | Defines the HTML version and document type. The <!DOCTYPE...> declaration supports the browser to display a web page properly. |
<html> | Describes the HTML Document. The complete HTML document can be in between these tags. Mainly includes of document header (<head>...</head>) and document body (<body>...</body>) tags. |
<head> | Provides the information about HTML Document. Represents HTML Document header.The header can keep other HTML tags like <title>, <link> etc. |
<title> | Provides the title of the document.Used inside the <title> tag. |
<body> | Describes the visible content of webpage.Represents the documents body. <body> tag contains all the tags that used to display the structure of web page. |
<h1> | Describes the Heading of webpage. |
<p> | Describes the paragraph of webpage. |