Tutorial 1 – Basic Elements of HTML

The basic elements of an HTML page are:

  • Text header, using like <h1><h2><h3><h4><h5><h6> tags.
  • Paragraph, using like <p> tag.
  • Horizontal Ruler OR divider using like <hr> tag.
  • Link, using like <a> (anchor) tag.
  • A list, using like <ul> (unordered list), <ol> (ordered list) and <li> (list element) tags.
  • An image, denoted using the <img> tag
  • A divider, denoted using the <div> tag
  • A text span, denoted using the <span> tag

The next few pages will give an overview of these basic HTML elements.

Each element can also have attributes – each element has a different set of attributes relevant to the element. There are a few global elements, the most common of them are:

  • id – Denotes the unique ID of an element in a page. Used for locating elements by using links, JavaScript, and more.
  • class – Denotes the CSS class of an element. Explained in the CSS Basics tutorial.
  • style – Denotes the CSS styles to apply to an element. Explained in the CSS Basics tutorial.
  • data-x attributes – A general prefix for attributes that store raw information for programmatic purposes. Explained in detailed in the Data Attributes section.
<!DOCTYPE html>
<html>
    <head>
    </head>
    <body>
        <h1>My First Page</h1>
        <p>This is my first page.</p>
        <h2>A secondary header.</h2>
        <p>Some more text.</p>
    </body>
</html>

Leave a Reply

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