K
K
Karen2015-09-25 02:58:16
css
Karen, 2015-09-25 02:58:16

How to implement an underscore on the active menu item?

Dear, tell me how to implement such an underline when hovering over a menu item. Googled it, didn't find anything. Shame on the question.
d31be50734e5434baef85c48b5b532e1.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Taratin, 2015-09-25
Bichakhchyan @karenboy

htmlbook.ru/css/border-bottom
https://jsfiddle.net/QW01_01/sgdw2ac2/

K
karbayev, 2021-12-03
@karbayev

Here is a solution I use on one of the projects
Underline from the center when hovering with the mouse
a.linkmenucategory {
display: inline-block;
color: #000000;
line-height: 2;
text-decoration: none;
cursor: pointer;
position: relative;
}
a.linkmenucategory:after {
display: block;
content: "";
background-color: #006633;
height: 4px;
width: 0%
left: 50%
position: absolute;
-webkit-transition: width .2s ease-in-out;
-moz--transition: width .2s ease-in-out;
transition: width .2s ease-in-out;
-webkit-transform: translateX(-50%);
-moz-transform: translateX(-50%);
transform: translateX(-50%);
}
a.linkmenucategory:hover:after,
a.linkmenucategory:focus:after {
width: 100%;
}
May come in handy.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question