HTML Elements
An HTML element is defined by a start tag, some content, and end tag.
<tag name> Content goes here....</tag name>
Examples:
<h1>First heading</h1>
<p> First paragraph</p>
Starting tag: <h1>
Ending tag: </h1>
Element content: First heading
Note: Some elements have no content (like the <br> element). These elements are called empty elements. Empty elements do not have an end tag!.
Nested HTML Elements:
HTML elements can be nested (this means that element can obtain other elements).
All HTML documents consist of nested HTML elements.
The following example consist four HTML elements(<html>, <body>, <h1> an d <p>).
<!DOCTYPE html>
<html>
<body>
<h1>First heading</h1>
<p>First paragraph</p>
</body>
</html>
Example explained
The <html> element is the root element and it defines the whole HTML document.
It has a start tag and an ending tag </html>.
Then, inside the <html> element there is a <body> element:
<body>
<h1>First heading</h1>
<p>First paragraph</p>
</body>
The <body> element defines the document's body.
It has a start tag <body> and an end tag </body>.
The <h1> element defines a heading.
It has a start tag <h1> and an end tag </h1>.
The <p> element defines a paragraph.
It has a start tag <p> and an end tag </p>.
Empty HTML Elements
HTML elements with no content are called empty elements.
The <br> tag defines a line break, and is an empty element without a closing tag:
HTML is not case sensitive
HTML tags are not case sensitive: <P> means the same as <p>.
The HTML standard does not require lowercase tags, but I recommends lowercase in HTML, and demands lowercase for stricter document types like XHTML.
Thanks for visit
Comments
Post a Comment
If you have any doubt feel free to text me.