Use of Attributes in HTML

Definition of HTML Attributes

HTML Attributes that defines additional characteristics of the tag or element.

In the html when we try to create the web pages that start with coding known as tag dependency.Some of html tag have  their attributes 

Why we use attribute in HTML ?

By default we can create html pages in black and white, that is not more attractive . So there is required few more properties that create attractive html pages.

Such as height or width of any image , you can write the alt properties of any images that shows additional information of particular element.

How we use attributes in html pages :

Each and every language have their own grammar rules to understand their language and their value.Same case in computer science world.Computer science world is covered with many programming or markup language for easy and accurate use as per requirement of user. Grammar word is known as syntax in the computer world.




Syntax of Attributes in HTML

<tagName Attributes=”Value”> content </tagName>

Know about html attributes and their types

In this article we will understand about the attributes and their type in HTML.

How to use attributes in HTML , we will learn here with the example of HTML attributes.In the web page we would like to insert an image, that is not possible with the additional properties of html attributes.By default html show their default value ,so we require to provide source information of an image.

You can change their value as you like to create web pages like image and their size and alt properties.

Each and every attributes is comprised with two parts first is known as name second is known as their value.


Type of attributes in HTML

 HTML attributes that helps to create faboulous webpages easy to understand with the graphic presentable page with value.


1. SRC Attributes

Use of src attributes in html to insert any image.For inserting image in html require a tag that is popular name with  <img> with their source address.

Syntax of inserting image in HTML

<img src="set_img_path"> </img>

 Follow above syntax properly to insert image

2. Width and Height Attributes

For the designing of web pages, height and width plays major role to attract the user with the graphics or text management. 

Syntax of inserting image and set their height and width in HTML

<img src="set-img-path" width="20" height="20"> html attribute </img>



3. Alt Attributes

Alt attributes is more helpful to identify the image which you would like to insert in web pages.Alt attributes is also useful in digital marketing .ALT that is used to alternative text of any image file.

Syntax of inserting 

<img src="set-img-path" width="20" height="20"> html attribute </img>



4. href Attributes

Why we use href in html, we will understand here the use of href in html .

href is use to refer a particular url or address.we can say href is use to provide a link in the webpages.There is syntax to write href attributes.We use <a> tag for creating link the html web page.

Syntax of inserting link in HTML

<a href=""> Learn html attribute </a>


5. lang Attributes

What is the use of lang attributes in creating web page.

Lang attribute is one of the most loved attribute globally that inform us which language is use to create the webpages.

lang attribute is also helpful in search engine optimization.for this we use lang tag example : <lang>

how to write lang attribute to create web page ? 

Syntax of using lang attribut in  HTML

<html lang="hi-ind">


6. style Attributes

Use of style attribute in html , to create attractive web page  with color, font size etc.

Style is also a tag that is use to create html element colorful , font formatting .With the element tag we can use style in same line before closing the tag.example are below mentioned.In the technical term we can say to apply css on particular element.

how to use CSS in  web page ? 

Syntax of using style attribute to design attractive webpage

<p style=colour:blue> paragraph </p>

 at the above we have used <p> tag that demonstrate the paragraph and set their formatting like color blue.


7. title Attributes

Title element is use to define the page title.It plays major role in search engine .for writing title we follow the syntax as described below.

<title>Name of the page</title>

example of title attributes , save the below line as .html extension.


<! DOCTYPE html>

<title> title Attribute example </title>

<p title="html attribute"> this is title attribute </p>


Summary:What we have learnt

  • alt attribute and use of it
  • Use of src attribute while inserting image
  • Why we use title attribute while creating the web pages
  • Font formatting is known as styling of image or element tag.In technical term we use style attribute
  • Lang attribute used to define language of web page
  • For creating link ,we add href attribute
  • For setting size of any video or image file , we use height and width attribute with their value.