HTML CSS JavaScript SEO Python Posts Privacy About Contact

HTML Attributes

Attributes provide additional information about HTML elements.

All HTML elements can have attributes. Attributes provide additional information about elements and are always specified in the start tag.

Attributes usually come in name/value pairs like: name="value".

Try It — The href Attribute

The <a> tag defines a hyperlink. The href attribute specifies the URL of the page the link goes to.

Preview

The src Attribute

The <img> tag is used to embed an image in an HTML page. The src attribute specifies the path to the image to be displayed.

Preview

The style Attribute

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

Preview

Common HTML Attributes

  • href - Specifies the URL of the linked resource
  • src - Specifies the URL of an image resource
  • style - Specifies inline CSS styles for an element
  • alt - Specifies an alternative text for an image
  • title - Provides extra information about an element (displayed as a tooltip)