An HTML element is defined by a start tag and an end tag. It contains some content between them.
HTML Elements Syntax:-
<start_tagname>Content write here…</End_tagname>
Example:-
Start tag | Element content | End tag |
<h1> | Write here content | </h1> |
<p> | Write here content | </p> |
<br> | none | none |
Note:- Some HTML elements have no content. Example :- <br> element
This element is called an empty element.
Nested HTML Elements
HTML elements can contain other elements i.e. called Nested HTML Elements.
Example:-
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>Heading</h1>
<p>Paragraph</p>
</body>
</html>
Here HTML elements contains <head>,<body>, <h1> and <p>. This is called Nested HTML Elements.
- <html> element is the root element that defines the whole HTML document.
- <html> element contains an <body> element, which defines the document’s body.
- <body> element contains two other elements: <h1> and <p>.
Also read, front-end developer Skills
Empty HTML Elements
HTML elements have no content i.e. called empty elements. The <br> tag is used to a line break, and this is called an empty element which has not have a closing tag.
Heading Tags
There are six different HTML headings.
<h1>This is heading 1</h1>
<h2>This is heading 2</h2>
<h3>This is heading 3</h3>
<h4>This is heading 4</h4>
<h5>This is heading 5</h5>
<h6>This is heading 6</h6>
very good