我正在创建一个带有下拉菜单的固定导航栏.不幸的是,当栏被修复时,下拉菜单不可见.我希望页面在需要时滚动,但导航栏必须始终可见.我已经看到了几个帖子,但没有一个给定的解决方案适合我.
下面的代码工作正常,但删除注释标记周围/*position: fixed;*/的麻烦发生.
问候
p {
font-family: Arial, Times, serif;
}
ul {
list-style-type: none;
font-family: Arial, Times, serif;
margin: 10;
padding: 0;
overflow: hidden;
background-color: #555555;
text-decoration: none;
/* remove comment below to see effect*/
/*position: fixed;*/
top: 0;
width: 100%;
/* Full width */
}
li {
float: left;
}
/* Add a gray right border to all list items, except the last item (last- child) */
li {
border-right: 1px solid #bbbbbb;
}
li:last-child { …Run Code Online (Sandbox Code Playgroud)