HTML Links - Colors & Download Link

HTML Link Colors

You can customize the colors of links using CSS. Links have various states, and you can style them differently:

  1. Normal State (a:link): The default state of the link.
  2. Visited State (a:visited): When a user has already visited the link.
  3. Hover State (a:hover): When a user hovers over the link.
  4. Active State (a:active): When a link is clicked.

Example: Link Colors

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Link Colors</title>
  <style>
    a:link {
      color: blue;
    }
    a:visited {
      color: purple;
    }
    a:hover {
      color: red;
      text-decoration: underline;
    }
    a:active {
      color: orange;
    }
  </style>
</head>
<body>
  <h1>HTML Link Colors</h1>
  <p>
    <a href="https://www.example.com" target="_blank">Visit Example.com</a>
  </p>
</body>
</html>

HTML Download Link

To create a download link, use the download attribute in the <a> tag. This attribute specifies that the target should be downloaded instead of navigating to it.

Example: Download Link

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Download Link</title>
</head>
<body>
  <h1>Download File</h1>
  <p>
    <a href="example-file.txt" download>Download Example File</a>
  </p>
</body>
</html>

Notes:

  1. Replace "example-file.txt" with the actual file path.
  2. The browser will prompt the user to download the file when they click the link.

Comments

Popular posts from this blog

Introduction to Computer

History of Computer

Computer Generation