B
B
bessard2020-12-08 17:32:56
css
bessard, 2020-12-08 17:32:56

How to style a link in css so that the underline when hovering over the link is some distance from the bottom?

Hello!
Need help styling active links - there is a horizontal line for the entire width of the layout that I made through .
It is necessary that when you hover over the link, the active area is also duplicated on this line. 5fcf8e5fed777720371334.png

attached TK.

I understand what needs to be done through hover?
Thanks for the help!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Evgeny Shcherbakov, 2020-12-08
@bessard

One option is to add padding-bottom and make underline through border-bottom (instead of underline)

a {
   padding: 10px;
   border-bottom: 1px solid transparent;
   text-decoration: none;
}

a:hover {
   border-bottom: 1px solid #fff;
   text-decoration: none;
}

B
bessard, 2020-12-08
@bessard

I made a solid line through the hr tag
, will this not affect the styling?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question