Simple HTML Elements
- HTML element is the collection of start and end tag with the content inserted in between them.
- In HTML end tag of element is necessary. Otherwise the displayed content may not be displayed correctly.
Note: - A HTML element with no content are called empty elements. Empty elements do not have an end tag, such as <br> element (which indicates a line break).
Nested HTML Elements
- The elements of HTML can be nested.
- When a HTML element is used inside another HTML element it is called Nested HTML Elements.
- All HTML documents consists of nested HTML elements.
Example
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>My Heading</h1>
<p>My Paragraph</p>
</body>
</html>
Try it »
Note: - Some HTML elements will display correctly, even if we forget the end tag like paragraph tag <p>.
Empty HTML Elements
- The element which has no content are called empty elements.
- <br> is an empty element.
- Empty elements do not have closing tag.
- The <br> tag is used for line break.
Example
<html>
<head>
<title>Page Title</title>
</head>
<body>
<p>This is a <br> paragraph with a line break.</p>
</body>
</html>
Try it »
Note: - HTML5 do not require empty elements to be closed, but it is recommended to close all HTML elements properly for reliability.
HTML is Not Case Sensitive
- HTML tags are not case sensitive.
- In HTML <P> is same as <p>.
- HTML5 standard do not require lowercase tags, but it is recommended to use lowercase in HTML, for stricter document types like XHTML.