Home HTML CSS JavaScript React Gamedatum.com
× Home HTML CSS JavaScript React Gamedatum.com

HTML Elements

HTML consists of elements which are defined by tags. There is an easy confusion as most people think that the tags are the same with the Elements.

An Element consists of two things: a tag and its content.
For example:

<p>Hi my name is Tom.</p> - this is a paragraph Element.

<p></p> - this is a tag for aparagraph, the tag itself without content

So, in short, anything between an opening and a closing tag is an HTML element.

There are also elements which do not necessarily have a closing tag and they also are considered HTML Elements, they are known as "empty" Elements:

<img>, <meta>, <area>, <link>,

<br>,<base>,<hr>, <keygen>,

<input>, <col>, <wbr>, <embed>,

<track>, <source> and <param>.

Nested HTML Elements

A nested element is an element that contains another element.

For example below we have a div element containing the h1 and p elements:

                <!-- Nested HTML Elements -->
                          <h1>My Heading</h1>
                          <p>This is my paragraph</p>

What are Block-level and Inline HTML Elements?

There are elements which when used form a block and start a new line, these are the Block Elements. Other Elements do not form a block and do not start a new line, these are the Inline Elements.

For example:

  <!-- h1 Heading is a Block Element -->
          <h1>My Heading</h1> 
  <!-- span is an Inline Element -->
          <p>This is my <span>Inline Element</span>inside the paragraph</p>

The Block level HTML elements are:

                      <div>, <h1> to <h6>, <p>, <header>, 
                      <nav>, <fieldset>, <li> , <main>, 
                      <address>, <ul>, <hr>, <article>, 
                      <aside>, <blockquote>, <canvas>, 
                      <footer>, <dt>, <figure>, <ol>, 
                      <figcaption>, <video>, <pre>, 
                      <section>, <tfoot>, <output>, 
                      <form>, <table>, <noscript>, 
                       <dl>, <dd>

The Inline level HTML elements are:

       <a>,<span>,<abbr>, <acronym>, , <samp>, <script>,
          <select>, <small>, <b>, <q>, <strong>, 
            <em>, <i>, <img>,  <label>, 
           <map>, <object>, <bdo>, <big>,
           <br>, <button>, <dfn>, <cite>, <code>, 
           <sub>, <time>, <sup>, <textarea>, 
          <tt>, <var>, <input>, <kbd>,