DEV Community

Robson Muniz
Robson Muniz

Posted on

5 3

📇How to Draw Underline Link Hover Effect | HTML & CSS✏️

Lets Create a Underline Link Hover Effect using just HTML CSS, step-by-step in a very easy to follow along tutorial.



Source Code:

Markup:

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Cool Underline Hover Effects</title>
  <link rel="stylesheet" href="style.css">
</head>

<body>
  <nav>
    <ul>
      <li><a href="#"></a>Home</li>
      <li><a href="#"></a>Services</li>
      <li><a href="#"></a>Contact</li>
      <li><a href="#"></a>About</li>
    </ul>
  </nav>

</body>

</html>
Enter fullscreen mode Exit fullscreen mode

css

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=swap');

*,
*::before,
*::after {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

body {
    background-color: #0a0a0a;
    color: rgb(226, 226, 226);
}

ul {
    height: 100vh;
    width: 70vw;
    min-width: 600px;
    display: flex;
    align-items: center;
    justify-content: space-around;
    margin: auto;
}
li {
    position: relative;
    list-style: none;
    font-family: 'Poppins', sans-serif;
    color: #a0a0a0;
    font-size: 18px;
    letter-spacing: 0.5px;
    padding: 0 10px;
}

li::after {
    content: '';
    position: absolute;
    background-color: #ff3c78;
    height: 3px;
    width: 0;
    left: 0;
    bottom: -8px;
    transition: all 0.5s ease;
}

li:hover {
    color: #fff;
}
li:hover::after {
    width: 100%;
}
Enter fullscreen mode Exit fullscreen mode

🛴 Follow me on:
YouTube: https://bit.ly/3oBQbc0
Facebook: https://bit.ly/3cp2S5W
Instagram{New}: https://bit.ly/3Ihh2EB

Sentry blog image

How I fixed 20 seconds of lag for every user in just 20 minutes.

Our AI agent was running 10-20 seconds slower than it should, impacting both our own developers and our early adopters. See how I used Sentry Profiling to fix it in record time.

Read more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay