HTML-Elements
Table of Contents
An HTML element is defined by a start tag (<tag_name>), some content, and an end tag (</tag_name>).
Start Tag | Content | End Tag |
<p> | This is paragraph tag. | </p> |
<h1> | This is heading tag. | </h1> |
<div> | This is division tag. | </div> |
<br /> | none | none |
<hr/> | none | none |
Syntax
<tag_name>Write some Content</tag_name>
Example
<h1>This is Heading 1 tag</h1>
<h1>This is Heading 2 tag</h1>
<p>This is Paragraph tag.</p>
<Start tag>Element content</End tag>
Some HTML elements have no content and therefore these elements do not have an end tag. Because of this these elements are called empty elements.
Example
<br/> = this tag use for break line
<hr/> = tis tag user for horizontal line
Nested HTML Elements
It is allowed to place one HTML element inside another HTML element, such as Nested HTML Elements.
The following example contains four HTML elements <html>
, <body>
, <h1>
, <p>, <i> and <b>
.
Example
<!DOCTYPE html>
<html>
<head><title>Nested Elements Example</title>
</head>
<body>
<h1>This is <i>font italic</i> heading</h1>
<p>This is <b>font bold</b> paragraph</p>
</body>
</html>
You forget the last(end) tag.
Some HTML elements will display correctly, even if you forget the last(end) tag.
Example
<!DOCTYPE html>
<html>
<body>
<p>This is <b>font bold</b> paragraph
<p>This is second paragraph
</body>
</html>
HTML is not case sensitive
HTML tags are not case sensitive <H1> means the same as <h1>
0 Comments