HTML/HTML Basics

HTML Attributes

Updated on January 6, 2026
1 min read

What is an HTML Attribute?

An HTML attribute gives extra information about an HTML element. 

Attributes describe or modify an element.

<img src="photo.jpg">

Here, 

  • img → element 
  • src → attribute 
  • "photo.jpg" → value 

Note: Attribute tells from where to load the image

Structure of an Attributes.

tag attribute="value"

Important Rules 

  1. Attributes are written inside opening tag
  2. Most attributes have name + value
  3. Values are written in quotes 

One Line to Remember

  • Element = What it is
  • Attribute = How it looks or works
HTML Attributes | HTML | Learn Syntax