What are elements, tags and attributes and the difference between them.

Elements are the building blocks of HTML language. Each element in HTML is an individual component on a particular webpage or document. They are in every part of the page, including the header, footer, body, and text.

There are two categories of elements:

  1. Inline Elements

  2. Block Elements

HTML tags define where an HTML element starts and where it ends. There is usually an opening bracket followed by the element’s name and finally, a closing bracket. There is always a start tag and an end tag enclosing an element.

For Example:

<body>.......<\body>

<p>...........<\p>

<b>..........<\b>

HTML attributes are used to modify an HTML element. It is usually in the form of some unique words that one inserts inside the opening tag. They control the behavior of the element.

Every tag has two sections of it. The first section is usually the name of the attribute, while the other section is its value. The two are usually separated by an equals sign (=).

For Example:

<input type = "text" name="email" size=15 value="type name here">

We have 4 attributes in above example:

  1. input type

  2. name

  3. size

  4. value