html - 当窗口最小化时,CSS 菜单会折叠

标签 html css menu web

我有一个跨页面的 css 菜单,我有几个跨到的 block ,我想要它,以便当窗口最小化时菜单保持不变而不是最小化

enter image description here

窗口未最小化时的样子

enter image description here

是页面最小化时发生的情况,我想要它,以便菜单被切断而不是改革。我也不知道如何让菜单 block (首页,排名......)转到页面的中心,它们留在一边

这是我的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;
    }

最佳答案

如果您希望它始终相同,则需要在导航元素上指定宽度。

nav { width : 960px; }

这应该会阻止它。

关于html - 当窗口最小化时,CSS 菜单会折叠,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16224158/

相关文章:

javascript - 如何使用 jQuery 比较 tr 中的几个 td.text()

c# - Gridview 中的 anchor 标记的服务器标记格式不正确

html - FA 图标发光/阴影

css - 在css中调整字体大小的权威方法

java - 当有人单击硬件按钮菜单设置时如何创建新 Activity

html - 带边框和 z-index 的 CSS 下拉菜单

javascript - 动态生成的表显示错误

css - 垂直对齐一个伪元素

jquery - 轻量级背景图片悬停动画jquery

Windows 批处理文件启动带有按钮的 gui