HTML Tutorial



HTML Attributes


💡 HTML Attributes

HTML attributes provide additional information about HTML elements. They are always specified in the start tag and usually come in name="value" pairs.

🔍 Syntax of an Attribute: <element attribute="value">Content</element>

✨ Common HTML Attributes

1️⃣ href

<a href="https://example.com">Visit</a>

Defines the URL for a link

2️⃣ src

<img src="image.jpg" />

Specifies the image path

3️⃣ alt

<img alt="description" />

Provides alternate text for images

4️⃣ style

<p style="color:red;">Text</p>

Adds inline CSS

5️⃣ title

<p title="Tooltip">Hover me</p>

Adds a tooltip when hovered

🛠️ Multiple Attributes

You can use multiple attributes in a single tag to define more properties.

<img src="logo.png" alt="Logo" width="100" height="100">
  

⚠️ Important Rules

  • Attribute names are not case sensitive (but lowercase is recommended).
  • Always quote attribute values (especially if they contain spaces).
  • Use the correct attribute for the correct tag.
✅ Pro Tip: Keep your code readable by using proper spacing and indentation, even with multiple attributes.

🌟 Enjoyed Learning with Us?

Help others discover Technorank Learning by sharing your honest experience.
Your support inspires us to keep building!

Leave a Google Review