Web Analytics

HTML Attributes

Beginner ~8 min read

What are Attributes?

Attributes provide additional information about HTML elements. All HTML elements can have attributes.

  • Attributes are always specified in the start tag
  • Attributes usually come in name/value pairs like: name="value"

The href Attribute

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

HTML
CSS
JS

The src Attribute

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

HTML
CSS
JS

The style Attribute

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

HTML
CSS
JS

Quick Quiz

Where are HTML attributes defined?

A
In the end tag
B
In the start tag
C
In the content
D
In the head section