HTML Attributes


The HTML attributes mean the properties of HTML elements. it provides additional information of HTML elements. such as style, id, class, title .. etc.

The Style Attribute

This attribute using we can apply Cascading Style Sheet (CSS). so you can see below the following example.

<p style = "color:red;">hello world</p>

The Id Attribute

This attribute using we can assign a unique identification name for an element. this class attribute used to apply Cascading Style Sheet (CSS) and javascript.

<p id="idno1">Hello World.</p>

The Class Attribute

This attribute using we can assign one or more class names for an element. this class attribute used to apply Cascading Style Sheet (CSS) and javascript.

<p class="class1 class2">Hello World.</p>
<p class="class3">Hello Ram.</p>

The Title Attribute

The title attribute is used to specify additional information about the element. HTML provides by default functionality like when user mouse hover on that particular element, At that time shows additional information.

<a title="Welcome to in googlee" href="https://www.google.com/">Please Click</a>

The href Attribute

A href attribute is used to add a link to specify the address in the anchor tag.

<a title="Welcome to in googlee" href="https://www.google.com/">Please Click</a>

The src Attribute

The src attribute is used to add a file to specify the source in the img tag.

<img src="lotus.jpg" />

The srcset Attribute

The image srcset attribute defines the URL of the image to use in a number of different situations.

<img 
  src="lotus.jpg"
  srcset="
    lotus-1.jpg 1.5x,
    lotus-2.jpg 2x,
    lotus-3.jpg 3x,
    lotus-4.jpg 4x,
    lotus-5.jpg 100x"/>

The alt attribute

The alt attribute provides the alternate information for an img tag.

<img src="lotus.png" alt="Lotus" />