• Tutorial List

HTML Attributes

Last updated Jul 08, 2020
HTML Attributes

What are HTML Attributes?

HTML Attributes are used to provide additional information about an HTML element.

  • All HTML elements can have one or more Attributes.
  • HTML Attributes are always specified in the start/opening tag.
  • Attributes usually come in name/value pairs such as: name="value"
  • All HTML attribute values ​​must be written within quotes.

👉 Example of HTML Attributes –

The style is an attribute and color:red; is the attribute value. The style attribute is used to add styles to an HTML element.

<h1 style="color:red;">This is a Heading</h1>

👉 Multiple Attribute Example –

The <img> tag is used to display Images –

<img src="https://bit.ly/2XosGbd" width="300px" height="200px" alt="HTML Image">
  • src
    • Source of the image which you want to display.
  • width
    • Set image width
  • height
    • Set image Height.
  • alt
    • About the Image.

Ask Questions

Your email address will not be published. Required fields are marked *