Cover Image for Body alink Attribute in HTML
102 views

Body alink Attribute in HTML

The alink attribute in HTML is used to define the color of an active link within the body of a webpage. However, it is an outdated attribute and is no longer supported in HTML5. It was primarily used in earlier versions of HTML to control the color of links when they were actively being clicked or pressed.

Instead of using the alink attribute, it is recommended to style active links using CSS. Here’s an example of how you can achieve the same effect using CSS:

HTML
<!DOCTYPE html>
<html>
  <head>
    <style>
      a:active {
        color: red;
      }
    </style>
  </head>
  <body>
    <a href="#">Click me!</a>
  </body>
</html>

In the example above, the CSS selector a:active targets the <a> (anchor) element when it is actively being clicked. You can then apply any desired styling properties to the active link, such as changing the color with the color property.

It’s worth noting that the :active pseudo-class is used for styling links during the time they are being activated and held down, while :visited is used for styling links that have been visited.

YOU MAY ALSO LIKE...

The Tech Thunder

The Tech Thunder

The Tech Thunder


COMMENTS