D
D
Discout2014-08-05 12:08:02
css
Discout, 2014-08-05 12:08:02

How to make an animated dash appear in CSS?

How to make a dash that appears on top when hovering over a menu item? I did it with help, border-top: 5px solid #fff;but the animation doesn't look right - the menu item itself shifts. How to implement it correctly?
ps page layout through bootstrap
My implementation:
c4a101c457d2f5aec908d1d24f0cb01c.gif

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Andrey Golumenov, 2014-08-05
@Discout

When adding from above border-top: 5px solid #fff;
Add property as well margin-top: -5px;
Or you can set it initially and specify
it on hoverborder-top: 5px solid #fff;

T
Trow_eu, 2014-08-05
@Trow_eu

Another option is to use box-shadow: inset - an inner shadow.
either without hover - padding, with - remove padding and add border

D
Discout, 2014-08-05
@Discout

Part of css code for navigation:

/*all statement*/

.navbar-nav > li > a {
  color: #fff;
  font-size: 15px;
  font-family: 'Myriad Pro';
  color: rgb( 255, 255, 255 );
  text-transform: uppercase;
  padding-top: 35px;
  display: inline-block;

}

.navbar-default .navbar-nav > li > a {
  color: #fff;
   -webkit-transition: all .2s ease-in-out;
       -o-transition: all .2s ease-in-out;
          transition: all .2s ease-in-out;
}

/*active statement*/

.navbar-default .navbar-nav > .active > a, .navbar-default .navbar-nav > .active > a:hover, .navbar-default .navbar-nav > .active > a:focus {
  background: none;
  color: #fff;
  padding-top: 30px;
  border-top: 5px solid #fff;

}

/*hover statement*/

.navbar-default .navbar-nav > li > a:hover, .navbar-default .navbar-nav > li > a:focus {
  background: none;
  color: #fff;
  padding-top: 30px;
  border-top: 5px solid #fff;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question