- 1
What is the role of an attribute in html
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
+ 1
an attribute defines more information about what you what to do with a special tag
example
width=" 100%" size=" 50" etc ....