我有一个跨越页面的css菜单,我有几个块可以访问,我想要它,以便当窗口最小化时,菜单保持不变并且不会最小化
是窗口未最小化时的样子
当页面被最小化时会发生什么,我想要它以便菜单被切断并且没有改变。此外,我无法弄清楚如何使菜单块(主页,标准...)转到页面的中心,他们留在一边
这是我的css代码
@charset "UTF-8";
/* CSS Document */
body, div, h1, h2, h3, h4, h5, h6, p, ul, ol, li, dl, dt, dd, img, form, fieldset, input, textarea, blockquote {
margin: 0; padding: 0; border: 0;
}
body {
font-family: Brixton , sans-serif; font-size: 22px; line-height: 0px;
// controls the text size, color, font
}
nav ul ul {
display: none;
//sets menu dislpay setting
}
nav ul li:hover > ul {
display: block;
//displays the block under the main tabs in the menu
}
nav ul {
background: #efefef;
background: linear-gradient(top, #efefef 0%, #bbbbbb 100%);
background: -moz-linear-gradient(top, #efefef 0%, #bbbbbb 100%);
background: -webkit-linear-gradient(top, #efefef 0%,#bbbbbb 100%);
box-shadow: 0px 0px 9px rgba(0,0,0,0.15);
//change menu background
padding: 0 20px;
list-style: none;
position: relative;
}
nav ul:after {
content: ""; clear: both; display: block;
//displays the background
}
nav ul li {
float:left;
//decides which side the menu is on
}
nav ul li:hover {
background: #4b545f;
background: linear-gradient(top, #4f5964 0%, #5f6975 40%);
background: -moz-linear-gradient(top, #4f5964 0%, #5f6975 40%);
background: -webkit-linear-gradient(top, #4f5964 0%,#5f6975 40%);
//changes the color of the menu when hovered over
}
nav ul li:hover a {
color: #fff;
}
nav ul li a {
display: block; padding: 25px 53px;
color: #007FFF; text-decoration: none;
}
nav ul ul {
background: #5f6975; border-radius: 0px; padding: 0;
position: absolute; top: 100%;
}
nav ul ul li {
float: none;
border-top: 1px solid #6b727c;
border-bottom: 1px solid #575f6a; position: relative;
}
答案 0 :(得分:2)
如果您希望它始终相同,那么您需要在nav元素上指定宽度。
nav { width : 960px; }
应该阻止它。