What are tags, Element and attributes in HTML?

What are tags, Element and attributes in HTML?

HTML Tags


  1. HTML Tags are used to mark up the start of an HTML element and they are usually enclosed in angle brackets.

    Ex: <h1> </h1> --> Heading tag

    <h1> --> Opening tag

    </h1> --> Closing tag

  2. HTML tags are almost like keywords where every single tag has a unique meaning.

HTML Attributes


  1. HTML Attributes contain additional pieces of information.

  2. HTML Attributes take the form of an opening HTML tag and additional info is placed inside.

    Ex: <img src = "Akash.jpg" alt = "My photo">

    in this instance,the image source(src) and the alternative text(alt) are attributes of the <img> tag.

HTML Elements


  1. HTML Elements enclose the contents in between the tags. They consist of some kind of structure or expression.

  2. It generally consists of a start tag, content and an end tag.

    Ex: <b> This is the Content. </b>

    Here content is the HTML Element.