Translate

ads

3 Jun 2019

HTML | Attributes

HTML | Attributes





        An attribute is employed to supply additional or extra data concerning part.



Ø  All hypertext markup language parts will have attributes. Attributes give extra data concerning part.

Ø  It takes 2 parameters : a reputation and a worth. These outline the properties of the component and is placed within the gap tag of the component. The name parameter takes the name of the property we might wish to assign to the component and therefore the price takes the properties price or extent of the 


Ø  Every name has some price that has to be written among quotes.





Syntax:



<element attribute_name="attribute_value"   





1. src Attribute :

If we wish to insert a picture into a webpage, then we'd like to use the attribute’s value inside the double quote


<html> 
<head> 
 <title>src Attribute</title> 
</head> 
<body> 
 <img src="https://sisayed360.blogspot.com/2019/04/blog-post.html"> 
</body> 

</html> 


 2 .  alt Attribute : 

 As the name goes this is often Associate in Nursing alternate tag that's accustomed show or show one thing if the first attribute.This can also be used to describe the image to a developer who is actually sitting at the coding end.



<html> 

       <head>                 
                <title>alt Attribute</title>   

        </head>

     <body> 

<!--If the image is not found or the img field  is left blank the alt value gets displayed-->

 <img src="https://sisayed360.blogspot.com/2019/04/blog-post.html">
<br> 

 <img src="" alt="Since the src value is blank,the alt value is displayed"> 

    </body>

 </html> 

  3. The width and height Attribute :





<html>
<head>
<title>Width and Height</title>
</head>
<body> <img src="https://sisayed360.blogspot.com/2019/04/blog-post.html" width="300px" height="100px" >
</body>
</html> 

  





4. The id Attribute :  

 


<html> 
<head> 
 <title>id Attribute</title> 
</head> 
<body> 
 <p id = "sayed">Hello <br> 
 <p id = "ui">This is unique to this paragraph<br> 
 <p id = "head">This is also unique to this paragraph 
</body> 

</html> 

5.The title Attribute :  




<html>
 <head> 
 <title>title Attribute</title>
 </head> 
<body>  <h3 title="Hello Sayed ">Hover to see the effect</h3>
 </body>

 </html> 

6. The href Attribute : 



<html>
<head>
 <title>link Attribute</title>
</head>
<body>
 <a href="https://sisayed360.blogspot.com/">
  Click to open in the same tab
 </a><br>
 <a href="https://sisayed360.blogspot.com/" target="_blank">
  Click to open in a different tab
 </a>
</body>
</html> 



No comments:

Post a Comment