Html 导航栏在悬停时向下推内容
我的网站上的导航栏有问题,尤其是Html 导航栏在悬停时向下推内容,html,css,hover,navbar,Html,Css,Hover,Navbar,我的网站上的导航栏有问题,尤其是 这是我的实时网站的链接:http://arkelectronics.ca/ 请注意:这个链接将不会显示在未来的问题,一旦我修复了它 您可以在GitHub上的“pre_fix_stackoverflow”分支上查看我的网站(修复之前)的所有文件: 我的导航栏的HTML: <nav> <ul> <li><a href="index.html">home</a></li>
这是我的实时网站的链接:http://arkelectronics.ca/
请注意:这个链接将不会显示在未来的问题,一旦我修复了它
您可以在GitHub上的“pre_fix_stackoverflow”分支上查看我的网站(修复之前)的所有文件:
我的导航栏的HTML:
<nav>
<ul>
<li><a href="index.html">home</a></li>
<li><a href="about.html">about</a></li>
<li><a href="services.html">services</a></li>
<li><a href="contact.html">contact</a></li>
</ul>
</nav>
nav li a {
height: 44px;
color: white;
padding: 0px 8px 0px 8px;
text-decoration: none;
background-color: transparent;
border-bottom: 0px solid #ededed; /* will be animated-in on hover */
border-top: 0px solid orange; /* will be animated-in on hover */
transition: border 200ms; /* the transition is applies to the border only, at a speed of 200ms */
display: table-cell; /* this, as well as the vertical-align, ensures text is vertically centered every time inside the nav buttons*/
vertical-align: middle;
}
/* when nav button is hovered over */
nav li a:hover {
border-bottom: 13px solid #ededed;
border-top: 13px solid orange;
}
/* when the mouse is held down on nav button */
nav li a:active {
border-bottom: 5px solid #ededed;
}
在css的第81行,将高度更改为51像素
李娜{
背景色:透明;
边框底部:0实心#eded;
边框顶部:0实心橙色;
颜色:白色;
显示:表格单元格;
高度:51px;
填充:0 8px;
文字装饰:无;
过渡:边界200ms到0秒;
垂直对齐:中间对齐;
}如下更改:
nav ul {
list-style-type: none; /* removes the bullet-point that's common with ul elements */
margin: 0;
padding: 0;
overflow: hidden;
}
nav li a {
height: 45px;
color: white;
padding: 0px 8px 0px 8px;
text-decoration: none;
background-color: transparent;
border-bottom: 0px solid #ededed; /* will be animated-in on hover */
border-top: 0px solid orange; /* will be animated-in on hover */
transition: border 200ms; /* the transition is applies to the border only, at a speed of 200ms */
display: table-cell; /* this, as well as the vertical-align, ensures text is vertically centered every time inside the nav buttons*/
vertical-align: middle;
}
我添加了溢出:隐藏代码>属性,因为IE10上存在错误
然后像这样:
nav ul {
list-style-type: none; /* removes the bullet-point that's common with ul elements */
margin: 0;
padding: 0;
overflow: hidden;
}
nav li a {
height: 45px;
color: white;
padding: 0px 8px 0px 8px;
text-decoration: none;
background-color: transparent;
border-bottom: 0px solid #ededed; /* will be animated-in on hover */
border-top: 0px solid orange; /* will be animated-in on hover */
transition: border 200ms; /* the transition is applies to the border only, at a speed of 200ms */
display: table-cell; /* this, as well as the vertical-align, ensures text is vertically centered every time inside the nav buttons*/
vertical-align: middle;
}
我更改了height
属性。现在在IE10上运行良好,希望它对您有好处。而且该站点没有响应,所以请立即停止,担心第一次更改高度会固定它,谢谢!请问溢出:隐藏到底是什么代码>修复?当我添加这个属性时,我没有注意到任何不同(只是好奇)。我在IE10上有一个bug,下面的内容在导航栏菜单旁边。当内部有浮动元素(如:)时会发生这种情况