HTML Elements

HTML documents are composed entirely of HTML elements that, in their most general form have three components:

1. A pair of tags,
2. A “start tag” and
3. “end tag”;
some attributes within the start tag; and finally, any textual and graphical content between the start and end tags, perhaps including other nested elements. The HTML element is everything between and including the start and end tags. Each tag is enclosed in angle brackets.
The general form of an HTML element is therefore:

<tag attribute1="value1" attribute2="value2">content</tag>

Some HTML elements are defined as empty elements and take the form

<tag attribute1="value1" attribute2="value2" >

Empty elements may enclose no content, for instance, the BR tag or the inline IMG tag. The name of an HTML element is the name used in the tags. Note that the end tag’s name is preceded by a slash character, “/”, and that in empty elements the end tag is neither required nor allowed. If attributes are not mentioned, default values are used in each case.
Element examples:

1.Header of the HTML document:

Usually the title should be included in the head,
For example:

<html>
<head>
<title>techTutorialsOnline title</title>
</head>
<body>
Some text here
</body>
</html>

2. Headings:

HTML headings are defined with the <h1> to <h6> tags:

Try it

<html>
<head>
<title>techTutorialsOnline title</title>
</head>
<body>
<h1>Heading1</h1>
<h2>Heading2</h2>
<h3>Heading3</h3>
<h4>Heading4</h4>
<h5>Heading5</h5>
<h6>Heading6</h6>
</body>
</html>

3. Paragraphs:

Try it

<html>
<head>
<title>techTutorialsOnline title</title>
</head>
<body>
<p>This is Paragraph 1</p>
<p>This is Paragraph 2</p>
</body>
</html>

4. Line breaks: <br />

The difference between <br /> and <p> is that ‘br’ breaks a line without altering the semantic structure of the page, whereas ‘p’ sections the page into paragraphs. Note also that ‘br’ is an empty element in that, while it may have attributes, it can take no content and it may not have an end tag.

<p>This <br /> is a paragraph <br /> with <br /> line breaks</p>

 

5. Comments:

<!-- This is a comment -->

Comments can help in the understanding of the markup and do not display in the webpage

.