HTML - HyperText Markup Language

What's an Attribute?

Attributes are settings, values or information written inside a tag to give additional information about an HTML element.

<tag atttribute="value">

Some of the most common attributes are class= and id= which are used to assign a class or an id to an element. These are often used to link CSS styles to specific elements on a page.

The 8 all-purpose Attributes :

  • id=: gives a unique identifier to an HTML element
  • class=: assigns one or more classes to an element for styling or selection
  • href=: specifies the destination URL of a link
  • src=: defines the source file of an element
  • alt=: provides alternative text for images
  • type=: defines the type of behavour of an element
  • value=: sets the value of form elements like inputs or buttons
  • style=: applies inline CSS styles directly to an element

Attribtues values vary widely depending on the attribute. In most cases, they are URLs, keywords, classes, IDs, or free-form text.