HTML syntax is made of four main and most common components:

  1. Element
    • an element defines the page's structures
    • element can empty or non-empty
    • examples are <body>, <p>, <form> or <br />
  2. Attributes
    • an attribute is a property assigned to an element
    • many attributes are common amongst elements while some can be assigned only a particular element
    • examples of a common attribute is id="", class="" or title="" while a specific attribute would be cellpadding="" or maxlength=""
  3. Element's body or text
    • element's text can be assigned only to non-empty elements and it must be integrated between opening and closing tags
    • example is <p>This is my first website</p>
    • regular comments are added to the HTML syntax in order to better understand the internal process or in order to bypass certain parts of code
    • conditional comments can be used to conduct a special message to a proprietary software, i.e. it can be used with Internet Explorer to check which version is running
    • comments are not displayed in a browser


HTML example with comments inside the code:


›› go to examples ››