Introduction of HTML Attribute – What is Html Attribute?

Introduction of HTML AttributeIntroduction of HTML Attribute

Introduction of HTML Attribute

Introduction of HTML Attribute – What is Html Attribute?

Our purpose in learning HTML language is that we can create an awsome web page. Now, html tags give a simple structure to a web page. That is why it is very important for us to have knowledge of the attributes of these elements for additional improvement.

 

In this post HTML ATTRIBUTE IN HINDI you will know what is html attribute? And how they are used in html.

So let’s consider Start

What is html attribute – html attribute

So far how do you use any html element while creating html document? Obviously, in its simple form. For example if you add an image to a web page, you will write it as <image>. But if you need the height, width, url, alt text etc. of that image What would you do if you want to set it. Here are the attributes, these attributes of html element. Overall, if seen, the html attribute provides an html element (tag) to extra configure or provide additional information about that element.

If understood well, an attribute is used to define the attributes of the html element. These attributes are placed within the opening tag of the html tag.

Example-:

<img src = “set-img-path” alt = “alt-text” height = “11” width = “11”> </img>

All attributes consist of two parts. a. name and b. value.

o name is a property you want to set. for example – src attribute is used to extra configure the image. So here the name of the attribute of image tag is src. Which we will use to extra configure the image.

  • Value is what you want to set in that element by property. The value is always written within quotation (“”). In the upper example, the value attribute of the image attribute is url, where setting the url of the image starts showing the image in the web page.

The Attribute name and value of all html tags are always written in the small latter.

Example-;

<! DOCTYPE html>

<html>

 

<head>

<title> image attribute example </titel>

</head>

 

<body>

 

<img> src = “set_mg_url” alt = “set_alt_text” width = “set_img_width” height = “set_img_height”

 

</body>

 

</html>

By now you might have understood what the html attribute is? And how can we use it to provide additional information to the html element. So let’s now know about some of the most used html attribute in html.

Html attribute list

By the way, the html attribute list is very long, which is difficult to tell in a post with an example. But there are some html attributes that are most used in html. That is why they are described with an example below.

  1. src attribute.

The <img> tag is used to insert an image in html. src is the attribute of img tag. The src attribute is used to set the source address of the image.

There are two ways to set the source address of img in HTML. If the image is saved in the same location in your computer. Where you have saved the document file, you can set the image just by giving its name. But if the image is saved in a different location on the computer, then you have to give its complete path.

Example-:

<img src = “set_img_path”> </img>

  1. Width and height Attribute.

The size attribute is used to set the size of the image in Html. The height and width of the image are set with the help of the size attribute.

Example-:

<! DOCTYPE html>

 

<html>

<head>

<title> example of height and width attribute </title>

</head>

<body>

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

 

</body>

</html>

  1. Alt Attribute.

The alt attribute is used to specify alternative text. The alt attribute provides alternative information for an image. If for some reason the image does not show on the web page, then by this the user moves his mouse over the picture and what is that image about. It can find out.

Example-:

<! DOCTYPE html>

 

<html>

<head>

<title> alt attribute example </title>

</head>

<body>

<img src = “set-img-path” alt = “set-img-alt-text”> html attribute </img>

 

</body>

</html>

  1. href Attribute

Html Link is defined by <a>. The <a> tag uses the href attribute to specify the link.

Example-:

<! DOCTYPE html>

 

<html>

<head>

<title> href attribute example </title>

</head>

 

<body>

<a href=”www.nayaseekhon.com”> html attribute </a>

 

</body>

</html>

  1. lang Attribute.

The language of a document is declared in the html tag with the help of the lang attribute. It is mandatory to set language of html document for accessibility applications and serch engine.

Example =:

<! DOCTYPE html>

 

<html lang = “hi-ind”>

 

<head>

<title> lang attribute example </title>

 

</head>

<body>

….

 

</body>

</html>

  1. Style Attribute.

The style attribute is used to specify the style (color, font, size etc.) of an element.

Example-:

<! DOCTYPE html>

 

<html>

<head>

<title> Style attribute example </title>

</head>

 

<body>

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

 

</body>

</html>

⇒ ALL html tags list in hindi.

  1. title Attribute.

title Attribute provides additional information about an element. When the mouse is moved over the element in which the title attribute is used, the information set is shown as tooltip text.

Example-:

<! DOCTYPE html>

 

<html>

<head>

<title> title Attribute example </title>

 

<body>

<p title = “html attribute”> this is title attribute </p>

 

</body>

</html>

Summary -:

  • The html attribute provides additional information to an html element.
  • All html elements have attributes.
  • html attributes are defined by name and value.
  • The value of the html attribute is written within double quote (“”).
  • html Attribute is always written within the starting tag of the element.
komal mishra: