1

I added a border/line above my nav links on hover, except now it moves my text down each time you hover over it. What is causing that?

#nav a:hover{
border-top:solid 4px #3b5998; 
color:#b7c3e6; 
padding: 6px}


.header-alignment-left.header-navigation-split #topNav{position:absolute; right:-15px}

.logo-image #topNav nav li a{padding:5px 15px; line-height:100%}
#nav a{border-top:0px solid transparent}
#nav .subnav{margin-top:0}

#nav a{border-right:1.5px solid #3b5998; height:20px}
#nav li:last-child a{border-right:0}

#topNav nav .folder ul li a {   
-webkit-transition: all 0.2s ease-in-out;
-moz-transition: all 0.2s ease-in-out;
-ms-transition: all 0.2s ease-in-out;
-o-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out  }

#header #topNav nav .folder ul li{padding:0 24px 12px; position:relative; } 
#header{margin-top:20px !important}
#topNav{margin-top:40px}
#nav .subnav ul{padding-bottom:15px !important}
#nav .subnav ul{padding-top:15px !important}
4

1 回答 1

0

给它分配一个margin

像这样的东西应该工作。

#nav a:hover{
border-top:solid 4px #3b5998; 
color:#b7c3e6;
margin-top: 10px; 
padding: 6px}

margins如果需要,您甚至可以使用负数。

您可能想要删除并用orpadding替换它,这样您就不会移动链接的顶部和底部。padding-leftpadding-right

于 2013-08-29T23:10:43.003 回答