HTML Element are also called as tags. In HTML Web page has contains different open tags and close tag. The main content distinguish between these tags. Every document contains in the form of an opening tag, some content, and a closing tag. Some HTML tags are unclosed like <br>. While opening a web page in a web browser, it will read all HTML tags and display the result on screen. Each HTML tags have different attributes or properties.
Every HTML Document contains common and special tags. These tags will be read from left to right and top to bottom of every page. The simple structure of HTML Element Follows below.
|Start tag||Element content||End tag|
|<h1>||This is a Heading||</h1>|
|<p>||This is a Paragraph||</p>|
|<a href=”index.html”>||This is a Link||</a>|
|<br>||Not Required||Not Required|
HTML Element Syntex
- HTML element starts with an opening tag.
- HTML element end with closing tag
- Elements commonly have an opening tag and a closing tag
- Content can then go between two tags.
- Some HTML elements have empty content
- If you still confused about HTML elements, don’t worry you will learn more about in the next chapter
- HTML tags are not case sensitive that means <p> and <P> both are same.
Nested HTML Elements
Most HTML documents consist of nested HTML elements, which means you can an element and insert another element before first element closing tag.
<html> <head> <title>Nested HTML element</title> </head> <body> <h1>First Heading</h1> <p>This is my first paragaraph and using <b>nested html element</b>.</p> </body> </html>
<html> every html document will start with this tag.
<body> element defines the body of the HTML document.
We know <html> is a starting tag and </html> is closing tag.
<p> tag is paragaraph tag and that contains nested html tag that is <b>, </b>.
<b> HTML tag is used for bold text and also <strong></strong> tag.
- Don’t forget to insert the end tag of each opening tag.
- In case you forget it, the web page will open but a few errors displayed in background process.
- You can’t see the direct HTML tag result on screen.
- Some of the browsers not accepted all tags.
Empty HTML Element
Some HTML tags don’t have a closing tag. for example <br>. The <br> tag breaks paragraph and start newline.
So that <br> is an empty element without a closing tag.
Both <br> and <br /> tags working in all modern browsers.