<body> alink Attribute in HTML
What is alink attribute?
As we know, in HTML, we write each and every line of code into some tags. Each tag has its own meaning, which is understood by the browser. Each tag has different attributes, which are used to add more functionality to that particular component using some line of code in the tag. In the same way, we have alink attribute in the body tag. The body tag is the tag where all the other tags are enclosed.
alink attribute is used to give the color to an active link on the web page. By default, the active link is blue, but we can change it to whatever color using alink attribute.
colorName: We can give directly the color name which we want, like 'yellow','blue' or 'green' etc.
hexCode: Here, we can give the hex code of the color we want, like #ffffff. The hex code contains six characters ranging from 0 to 9, and it starts with #. For example, #ffffff represents the white color, and #000000 represents the black color.
RGBValue: AS we know, each color is a mixture of Red, Blue, and Green color. So we can give the RGB value ranges from 0 to 255 to provide the color name. For example, 000 represents the black color, whereas 255,255,255 represent the white color.
In the above code, we have implemented the alink attribute in the body. We have created the web page where we use the body tag in which we used the alink attribute with a value of yellow. It means if there are any active-link in the body section, then it would turn into a yellow color. Then we took one h1 tag and styled it with greenYellow color. We took the h2 tag without any attribute. Then we use a tag or anchor tag, which is used to implement or create any link, and the target for this link is nothing. For this, we have set the href attribute to '#'.
When we run the code, the color of the text in a tag should be yellow. But, it is blue as by default because HTML5 does not support alink attribute.
alink attribute was supported by the HTML versions lesser than HTML5.
Note: To change the color of an active link, we cannot use alink attribute in HTML5, but we can use the CSS styling and can change the color.