Learn

HTML – Elements

Advertisement

An HTML element is outlined by a beginning tag. If the element comprises different content material, it ends with a closing tag, the place the element identify is preceded by a ahead slash as proven under with few tags −

Start Tag Content End Tag
<p> Paragraph content. </p>
<h1> Heading content. </h1>
<div> Division content. </div>
<br />

So right here <p>….</p> is an HTML element, <h1>…</h1> is one other HTML element. There are some HTML elements which do not have to be closed, akin to <img…/>, <hr /> and <br /> elements. These are often called void elements.

HTML paperwork consists of a tree of those parts and so they specify how HTML paperwork needs to be built, and what sort of content needs to be positioned in what a part of an HTML doc.

HTML Tag vs. Element

An HTML element is outlined by a beginning tag. If the element accommodates different content material, it ends with a closing tag.

For instance, <p> is beginning tag of a paragraph and </p> is closing tag of the identical paragraph however <p>That is paragraph</p> is a paragraph element.

Nested HTML Elements

It is extremely a lot allowed to maintain one HTML element inside one other HTML element −

Example

<!DOCTYPE html>
<html>

   <head>
      <title>Elements Example</title>
   </head>
  
   <body>
      <h1>Its<i>italic</i> heading</h1>
      <p><u>underlined</u> paragraph</p>
   </body>
  
</html>

This will display the following result −

Itsitalic heading

underlined paragraph

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Check Also

Close
Privacy Policy | DMCA | Contact US
Back to top button
Close