HTML Attributes

  • • All HTML elements can have attributes.
  • • Attributes provide additional information about elements.
  • • Attributes are always specified in the start tag.
  • • Attributes usually come in name/value pairs like: name="value."

Style Attribute:

• The style attribute is used to add styles to an element, such as color, font, size, and more.

Example:

<p style="color:red;">This is a red paragraph.</p>

OUTPUT:

This is a red paragraph.

Title Attribute:

• The title attribute defines some extra information about an element.

• The value of the title attribute will be displayed as a tooltip when you mouse over the element.

Example:

<p title="I'm a tooltip"> This is a paragraph. </p>