HTML Elements
An HTML document consists of HTML elements.
HTML elements are defined by HTML tags.
HTML Tags
- HTML tags are markup surrounded by angle brackets like <html>
- HTML tags normally come in pairs like <b> and </b>
- The first tag in a pair is the start tag, the
second tag is the end tag
HTML Elements
- An HTML element starts with a start tag
- The element content is everything between the start and end tag
- An HTML element ends with an end tag
- Some HTML elements have no content
- Some HTML elements have no end tag
Example
<html>
<body>
<p>This is my first paragraph</p>
</body>
</html>
|
The example above contains 3 HTML elements.
A <p> Element
The <p> element defines a paragraph in the HTML document:
<p>This is my first paragraph</p>
|
The element has a start tag <p> and an end tag </p>
The element content is: This is my first paragraph
A <body> Element
The <body> element defines the body of the HTML document:
<body>
<p>This is my first paragraph</p>
</body>
|
The element has a start tag <body> and an end tag </body>
The element content is another element (a paragraph)
An <html> Element
The <html> element defines the whole HTML document:
<html>
<body>
<p>This is my first paragraph</p>
</body>
</html>
|
The element has a start tag <html> and an end tag </html>
The element content is another element (the body)
Empty HTML Elements
HTML elements without content are called empty elements. Empty elements have
no end tag.
<br> is an empty element without a closing tag.
In XHTML, XML, and future versions of HTML, all elements must be closed.
Adding a slash to the start tag, like <br />, is the proper way of closing empty elements, accepted by HTML, XHTML and XML.
Even if <br> works in all browsers, writing <br /> instead is more future
proof.
Why Lowercase Tags?
HTML tags are not case sensitive: <P> means the
same as <p>. Plenty of web sites use uppercase HTML tags in their
pages.
W3Schools use lowercase tags because the World Wide Web Consortium (W3C) recommends lowercase in
HTML 4, and demands lowercase tags in newer versions of (X)HTML.
 |

|
|
See why there are 20,000+ Ektron integrations worldwide.
Request an INSTANT DEMO or download a FREE TRIAL today. |
|
|
|