The alt, href, source and style  attributes in HTML

 The alt, href, source and style  attributes in HTML

In this tutorial, we will learn about the followings;

  1. HTML Attributes
  2. Quotes Attributes in HTML
  3. Quotes contain space Attributes in HTML
  4. Single or Double Quotes Attributes in HTML
  5. The Alt Attribute in HTML
  6. The href Attribute in HTML
  7. The src Attribute
  8. The style Attribute
  9. The Title Attribute in HTML
  10. Width and Height Attributes in HTML

HTML Attributes
HTML elements can have the attributes. Attributes are the properties for a specific HTML element.
Attributes provide detailed information about an element.
Attributes are always specified in the start tag represented by < >.
Every attribute must have a value. For example, see the mentioned font element.
<font color=”red”>this is font</font>
In this example, the font is the HTML element color is the attribute of the font and red is the value of the font element.

Quotes Attributes in HTML

Href is the attribute and it is double quoted. The values of href attribute is “https://www.t4tutorials.com”.

Try It

Quotes contain space Attributes in HTML

We cannot apply quotes around an attribute value, if the value contains spaces.It is recommended to use the quotation around the value of the attributes.

Try It

Single or Double Quotes Attributes in HTML

Double quotes around attribute values are the most commonly in HTML, but single quotes are also allowed to use. Sometimes, when the attribute value itself contains double quotes, then it is mandatory to use single quote.

Try it

The Alt Attribute in HTML

The value of the alt attribute will display if image is unable to appear. It is supporting for SEO of  the web page.

Try it

The href Attribute in HTML

HTML links must be in <a> tag. The URL of the page is specified in the href attribute of the <a>.

Try it

The src Attribute

In this example img is the HTML element for putting images on the web page. The src, width and height are the attribute of the image. Here, jpg, 300 and 100 are values of the attribute. 

Try it

The style Attribute

We can apply a style on any of the HTML element.

Try it

The Title Attribute in HTML

We can add title attribute to the paragraph elements. The value of the title attribute will be displayed as a tooltip when you mouse over theh1, h2 and p.

Try it

Width and Height Attributes in HTML

We can assign src of the image. The source can be any URL. Width and Height can be applied on the image to see the image according to your desired size.

Try it