Wednesday, 17 June 2020

#4 HTML Attributes

HTML attributes are special words used inside the opening tag to control the element's behaviour ...

Important points:

  • Attributes are always specified in the start tag .. i.e. <a href='https://wdforbeginner.blogspot.com/' >.....</a> here href is a attribute.
  • Attributes usually comes in name/value pairs like: name="value" 
  • Attributes provide more information about elements ....

Examples 

  • href attribute - specifies the URL of the page.                                        eg.<a href='https://wdforbeginner.blogspot.com/'>Web Development for Beginner</a>                                                    here <a> is anchor tag.If some one's click on the text he/she go to the link..
  • src attribute- specifies the path of a file .                                            eg. <img src="image.jpg"/>                                                          here <img > is a image tag. it loads the image 
  • width and height attributes -  eg. <img src='image.jpg' width='200' height='100'>    (specifies width and height in pixels )
  • alt attributes - alt attributes is always use with <img> tag that specifies alternate text for an image , if the images not shown due to some error..    eg. <img src='image.jpg' alt='image of a boy'/>  
  • style attribute - style attributes is used to add styles to an element ,such as color , background color,font ,size , and more ...                                    eg. <p style="background-color:grey;font-size:10px;">Hello world!</p> 

Like tags ,we can't remember all the attributes at once but we will go through all the possible attributes in this blog ...
here's the list of attributes in HTML ,go through the below link


Next we will learn about HTML Headings....So if you have any doubt comment below..
and share this blog ,follow and subscribe for more updates.....


No comments:

Post a Comment