-1

I am looking for a way to make an underline shoot across underneath a link when hovered and go away again when the mouse in not hovering. I'm not sure if I'm doing a good job explaining, so please tell me if you don't understand. I'm pretty sure that this cannot be done with an actual underline, maybe with an <hr> tag? Any help is appreciated!

Adrift
  • 58,167
  • 12
  • 92
  • 90
812402
  • 3
  • 2

2 Answers2

0
a {
    text-decoration: none;
    display: inline-block;
    border-bottom: 1px solid blue;    
    margin-right: 39px; 
    width: 0px;
    -webkit-transition: 0.5s ease;
            transition: 0.5s ease;
}

a:hover {
    -webkit-transition: 0.5s ease;
            transition: 0.5s ease;
    border-bottom: 1px solid blue;
    width: 30px;
    margin-right: 9px;
}

Taken from here: Underline css3 transition

Community
  • 1
  • 1
Ian
  • 50,146
  • 13
  • 101
  • 111
0

This is very simple CSS:

a {
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

But this is just for a hover effect, if you want a transition, then the above answer should work.

JesseG17
  • 664
  • 1
  • 5
  • 17