What is the role of an attribute in html | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

What is the role of an attribute in html

26th Dec 2016, 5:48 PM
Soumya Shetty
Soumya Shetty - avatar
2 Answers
+ 2
to further describe the element it is attached to. if you know <a>click</a> is a link then by adding attributes you can give it more meaning and function as an example you can add the href attribute to give the link a destination <a href="//www.google.com">click</a> now the link will take you to google when clicked or <a class="green">click</a> now the link is the color green as long as your css defined the name green to be the color green
26th Dec 2016, 6:01 PM
david
+ 1
an attribute defines more information about what you what to do with a special tag example width=" 100%" size=" 50" etc ....
30th Dec 2016, 3:28 AM
Abdel
Abdel - avatar