Tags:
- 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.
HTML tags are keywords (tag names) surrounded by angle brackets:
<tagname>content</tagname>
Attributes:
Tags can also have attributes, which are extra bits of information. Attributes appear inside the opening tag and their values sit inside quotation marks. They look something like:
<tag attribute="value">Margarine</tag>
Elements:
Elements are the bits that make up web pages.
Example 1:
<body> The quick brown fox jumps over the lazy dog. </body>
everything that is in between (and includes) <body> and </body> tags is the body element.
Example 2:
<title>Rumple Stiltskin</title>
“<title>” 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 tag 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> | The <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 tags like <h1>, <div>, <p> etc. |
<!-- … --> | Defines a comment. |