HTML Elements
An HTML elements is defined by a start tag , some content ,and an end tag
HTML Elements
The HTML Element is everything from the start tag to end tag
< h1 > Content Goes here< /h1 >Example of some HTML elements
< h1 > My First Heading< /h1 >
< p > This is Paragraph< /p >
Start tag | Element content | End tag |
---|---|---|
< h1> | My First Heading | < /h1> |
< p> | My First Paragraph | < /p> |
< br> | none | none |
Nested HTML Elements
HTML Elements can be Nested.
All HTML Elements consist of nested HTML Elements
The following example contains four HTML elements ( < html>, < body>, < h1> < p> and < p>
Example
Example Explained
The < html> element is the root element and it defines the whole HTML Document.
It has a start tag < html> and an end tag < / html>
Then inside the < html> element there is a < body> element
Example
The < body> element defines the documents body
It has start tag < body> and end tag < /body>
Then inside the < body> element there are two other element, < h1> and < p> .
Example
The < h1> element defines a heading
It has a start tag < h1> and an end tag < /h1>
Example
The < p> element defines a paragraph.
It has a start tag < p> and an end tag < /p> .
Example
Never skip the end tag
some HTML elements will display corrently even if you forget the end tag.
Example
However never rely onthis Unexpected result and errors may occur if you forget the end tag
Empty HTML elements
HTML elements with no content are called empty elements.
The < br> tag defines a line break and is an empty elment without a closing tag .