html - 如何在悬停时阻止其他文本在我的导航栏上向下移动?

标签 html css navbar

我试图让我的导航栏上的文本在悬停时变大,我设法做到了,但是当我这样做时,其他文本链接略微向下移动并将其他文本链接推向右侧(除了结束一个)

这是我的代码:

/* -----------------------------------------------------------------*/

html, body {
margin:0;
padding:0;

}

.header {
margin-top:-7px;
background-color:#333333; 
height:70px;
}

.container {
 max-width: 940px;
 margin: 0 auto;
 padding: 30px 10px;
}

.nav {
list-style-type: none;
margin: 0;
padding: 0px 0;
color:white;
}

.nav li {
color: #fff;
display: inline;
font-family: 'Raleway', sans-serif;
font-weight: 600;
font-size: 15px;
margin-right: 25px;
text-transform: uppercase;
-webkit-transition: all 0.5s ease;
 -moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
-ms-transition: all 0.5s ease;
transition: all 0.5s ease;
} 


/* NAV PROPERTIES */

.nav li:hover{
cursor: pointer;
font-size:18px;
text-shadow:0px 0px 5px white;
margin-top: 10px; 
padding: 6px;
} 

最佳答案

.nav li上定义行高

.nav li {
    line-height: 10px;
}

https://jsfiddle.net/gnd6q0sp/1/

关于html - 如何在悬停时阻止其他文本在我的导航栏上向下移动?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32230411/

相关文章:

html - ASP RadioButtonList 元素下方内联

javascript - 阻止网页页面跳转到顶部

html - 导航栏的 Bootstrap 下拉菜单

html - 如何制作后台附件:fixed; not stretch the image?

javascript - Highcharts 日期

ios - 可在 IOS 浏览器中下载应用程序

html - :before pseudo-class doesn't work with images

html - 在 CSS/HTML 中扩展我的导航栏的边(就像标题一样)

javascript - 旋转盖流效果

javascript - 填写值后输入文本框时未触发提交。在IE中