The best HTML elements Tutorial In 2024, In this tutorial you can learn HTML elements,HTML Element Syntax,Nested HTML elements,HTML document instance,Examples of HTML parsing,Do not forget the end tag,HTML empty element,HTML Tip: Use Lowercase Tags,
HTML documents are defined by HTML elements.
Start tag * | Element content | End tag * |
---|---|---|
<P> | This is a paragraph | </ P> |
<a href="default.htm"> | This is a link | </a> |
<br> |
* Start tag is often called the start tag (opening tag),the end tag is often called theclosing tag (closing tag).
NOTE: You will learn more about the properties in the next chapter of this tutorial.
HTML documents consist of nested HTML elements.
The above examples contains three HTML elements.
<p> element:
The <p> element defines a paragraph in the HTML document.
The element has a start tag <p> and an end tag </ p>.
Element content is: This is my first paragraph.
<body> element:
The <body> element defines the body of the HTML document.
The element has a start tag <body> and an end tag </ body>.
Element content is another HTML element (p element).
<html> element:
The <html> element defines the whole HTML document.
The element has a start tag <html>, and an end tag </ html>.
Element content is another HTML element (body element).
Even if you forget to use a closing tag, most browsers will correctly display HTML:
The above examples can be displayed properly in the browser, because the closing tag is optional.
But do not rely on this practice. Forgetting the end tag can produce unexpected results or errors.
HTML elements without content are called empty elements. Empty elements are closed in the start tag.
<br> is no closing tag empty element (<br> tag defines a line break).
In XHTML, XML, and future versions of HTML, all elements must be closed.
Adding a slash at the beginning of the label, such as <br />, is the proper way to close empty elements, HTML, XHTML and XML accept this approach.
Even <br> in all browsers are effective, but using <br /> actually more long-term protection.
HTML tags are not case sensitive: <P> is equivalent to <p>. Many sites use uppercase HTML tags.
W3CSchool using lowercase tags because the World Wide Web Consortium (W3C) HTML 4recommended in lowercase, but in the future (X) HTML version of the mandatoryuse lowercase.