- Introduction of HTML || Bcis Notes
- HTML Editor || Bcis Notes
- HTML Basic Tag || Bcis Notes
- HTML Elements || Bcis Notes
- HTML Attributes || Bcis Notes
- HTML Headings And Paragraphs || Bcis Notes
- HTML Styles and Formatting || Bcis Notes
- HTML Comments and Colors || Bcis Notes
- HTML Quotations || Bcis Notes
HTML Elements || Bcis Notes
An HTML element is defined by a starting tag. If the element contains other content, it ends with a closing tag, where the element name is preceded by a forward slash as shown below with few tags:-
There are some HTML elements which don’t need to be closed, such as <img…/>, <hr /> and <br /> elements. These are known as void elements.
HTML elements with no content are called empty elements. Empty elements do not have an end tag, such as the <br> element (which indicates a line break).
Nested HTML Elements:-
It is very much allowed to keep one HTML element inside another HTML element.HTML elements can be nested (elements can contain elements).
The <html> element defines the whole document.
It has a start tag <html> and an end tag </html>.
Inside the <html> element is the <body> element.
The <body> element defines the document body.
It has a start tag <body> and an end tag </body>.
Inside the <body> element is two other HTML elements: <h1> and <p>.
The <h1> element defines a heading.
It has a start tag <h1> and an end tag </h1>.
The element content is “BCIS Notes”.
The <p> element defines a paragraph.
It has a start tag <p> and an end tag </p>.
The element content is” This page provides notes of each subject”.
Do Not Forget the End Tag
Some HTML elements will display correctly, even if you forget the end tag:
The example above works in all browsers, because the closing tag is considered optional.
Never rely on this. It might produce unexpected results and/or errors if you forget the end tag.
Empty HTML Elements:-
HTML elements with no content are called empty elements. <br> is an empty element without a closing tag (the <br> tag defines a line break):
Empty elements can be “closed” in the opening tag like this: <br />.
HTML Is Not Case Sensitive:-
HTML tags are not case sensitive: <p> means the same as <p>.The HTML5 standard does not require lowercase tags, but W3C recommends lowercase in HTML and demands lowercase for stricter document types like XHTML.
If you liked our content HTML Elements, then please don’t forget to check our other content HTML Attributes.