Html 水平css菜单<;李>;如果窗口未处于全屏状态,则在其下方重新定位项目

Html 水平css菜单<;李>;如果窗口未处于全屏状态,则在其下方重新定位项目,html,css,window,Html,Css,Window,我的CSS有问题。菜单工作正常,但当您将窗口从全屏调整到任何其他大小时,菜单在右端断开,在菜单下方的左侧再次启动。我在另一个页面上遇到了类似的问题,我用position:absolute解决了这个问题,但这似乎并不能解决这个问题。我不是初学者,但我不是职业选手。如果有人能帮我弄清楚如何让窗口从左向右滚动,而不是将菜单选项向下移动,那就太好了 我的css菜单中有一个div标签: <div id='cssmenu' align='justify' style="z-index: 1;">

我的CSS有问题。菜单工作正常,但当您将窗口从全屏调整到任何其他大小时,菜单在右端断开,在菜单下方的左侧再次启动。我在另一个页面上遇到了类似的问题,我用position:absolute解决了这个问题,但这似乎并不能解决这个问题。我不是初学者,但我不是职业选手。如果有人能帮我弄清楚如何让窗口从左向右滚动,而不是将菜单选项向下移动,那就太好了

我的css菜单中有一个
div
标签:

<div id='cssmenu' align='justify' style="z-index: 1;">

基本上,
  • 元素是从左向右浮动的。当组合列表元素的宽度超过
    的宽度时,它将中断并从新行开始

    您可以做的是给
    一个宽度:100%和溢出:hidden,这样您就看不到任何掉落的内容并开始新的一行

    然后您可以给
    一个宽度:1000px,这样
  • 就可以穿过屏幕并被切断,但仍然有些可见


    之后的问题是,您需要通过字体或填充来调整
  • 项的大小;如果使用多个布局,最好使用媒体查询调整大小。如果希望动态调整大小,可以编写javascript函数来处理大小/间距。

    基本上,
  • 元素是从左向右浮动的。当组合列表元素的宽度超过
    的宽度时,它将中断并从新行开始

    您可以做的是给
    一个宽度:100%和溢出:hidden,这样您就看不到任何掉落的内容并开始新的一行

    然后您可以给
    一个宽度:1000px,这样
  • 就可以穿过屏幕并被切断,但仍然有些可见


    之后的问题是,您需要通过字体或填充来调整
  • 项的大小;如果使用多个布局,最好使用媒体查询调整大小。如果希望它们动态调整大小,可以编写javascript函数来处理大小/间距。

    获取格式帮助。请参阅。以获取格式帮助。请参阅。好的,当我添加“溢出:隐藏”时,它现在不显示子下拉菜单项。它似乎没有覆盖在所有子菜单之上,这正是我想要的。这是否是子菜单问题的
      ?关于上述问题,下面是一个示例,说明我想查看子菜单,但它没有正常工作,当我添加“溢出:隐藏”时,现在它没有显示子下拉菜单项。它似乎没有覆盖在所有子菜单之上,这正是我想要的。这是子菜单问题的
        吗?关于上述问题,下面是一个示例,说明我想看到子菜单,但它不起作用
        <ul><br>
            <li class='has-sub'>  ~a href='index.html'>Home ~/a> ~/li>  
            <li class='has-sub'>  ~a href='index.html'>General Info~/a> ~/li>  
            <li class='has-sub'>  ~a href='index.html'>Downloads~/a> ~/li>  
            <li class='has-sub'>  ~a href='index.html'> ~/a> ~/li>  
            <li class='has-sub'>  ~a href='index.html'>Home ~/a> ~/li>  
            <li class='has-sub'>  ~a href='index.html'>Home ~/a> ~/li>  
        <ul>
        
        </code>
        
        #cssmenu ul,
        #cssmenu li,
        #cssmenu span,
        #cssmenu a {
            margin: auto;
            padding: 0;
            position: relative; 
            top: o;
            z-index: 1;
        }
        
        #cssmenu {
            height: 49px;
            border-radius: 5px 5px 0 0;
            -moz-border-radius: 5px 5px 0 0;
            -webkit-border-radius: 5px 5px 0 0;
            background: #fefefe;
            background: -moz-linear-gradient(top, #fefefe 0%, #eee9f0 100%);
            background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #fefefe),            color-stop(100%, #eee9f0));
            background: -webkit-linear-gradient(top, #fefefe 0%, #eee9f0 100%);
            background: -o-linear-gradient(top, #fefefe 0%, #eee9f0 100%);
            background: -ms-linear-gradient(top, #fefefe 0%, #eee9f0 100%);
            background: linear-gradient(top, #fefefe 0%, #eee9f0 100%);
            border-bottom: 2px solid #a30813;
            width: auto;
            z-index: 1;
        }
        
        #cssmenu:after,
        #cssmenu ul:after {
            content: '';
            display: block;
            clear: both;
            z-index: 1;
        }
        
        #cssmenu a {
            background: #fefefe;
            background: -moz-linear-gradient(top, #fefefe 0%, #ececec 100%);
            background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #fefefe), color-stop(100%, #ececec));
            background: -webkit-linear-gradient(top, #fefefe 0%, #ececec 100%);
            background: -o-linear-gradient(top, #fefefe 0%, #ececec 100%);
            background: -ms-linear-gradient(top, #fefefe 0%, #ececec 100%);
            background: linear-gradient(top, #fefefe 0%, #ececec 100%);
            color: #000;
            display: inline-block;
            font-family: Helvetica, Arial, Verdana, sans-serif;
            font-size: 12px;
            line-height: 49px;
            padding: 0 20px;
            text-decoration: none;
            z-index: 1;
        }
        
        #cssmenu ul {
            list-style: none;
            z-index: 1;
        }
        
        #cssmenu > ul {
            float: left;
            z-index: 1;
        } 
        
        #cssmenu > ul > li {
            float: left;
            padding-left: 45px; /* This value moves the menu to the left*/
            z-index: 1;
            position: relative;
        }
        
        #cssmenu > ul > li > a {
        color: #000;
            font-size: 12px;
            z-index: 1;
            position: relative;
            display:block;
        }
        
        
        #cssmenu > ul > li:hover:after {
            content: '';
            display: relative;
            width: 0;
            height: 0;
            position: absolute;
            left: 50%;
            bottom: 0;
            z-index: 0 !important;
            border-left: 10px solid transparent;
            border-right: 10px solid transparent;
            border-bottom: 10px solid #a30813;
            margin-left: -10px;
            float:left;
            margin-top:0px !important;
            z-index: 1;
        }
        
        #cssmenu > ul > li:first-child > a {
            border-radius: 5px 0 0 0;
            -moz-border-radius: 5px 0 0 0;
            -webkit-border-radius: 5px 0 0 0;
            float:left;
            margin-top:0px !important;
            z-index: 1;
        }
        
        #cssmenu > ul > li.active:after {
            content: '';
            display: block;
            width: 0;
            height: 0;
            position: absolute;
            left: 50%;
            bottom: 0;
            z-index: 1;
            border-left: 10px solid transparent;
            border-right: 10px solid transparent;
            border-bottom: 10px solid #a30813;
            margin-left: -10px;
            float:left;
            margin-top:0px !important;
            z-index: 1;
        } 
        
        #cssmenu > ul > li.active > a {
            -moz-box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.1);
            -webkit-box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.1);
            box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.1);
            background: #ececec;
            background: -moz-linear-gradient(top, #ececec 0%, #ffeeff ef 100%);
            background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #ececec),    color-stop(100%, #ffeeff ef));
            background: -webkit-linear-gradient(top, #ececec 0%, #ffeeff ef 100%);
            background: -o-linear-gradient(top, #ececec 0%, #ffeeff ef 100%);
            background: -ms-linear-gradient(top, #ececec 0%, #ffeeff ef 100%);
            background: linear-gradient(top, #ececec 0%, #ffeeff ef 100%);
            z-index: 1;
            margin-top:0px !important;
            z-index: 1;
        }
        
        #cssmenu > ul > li:hover > a {
            background: #ececec;
            background: -moz-linear-gradient(top, #ececec 0%, #ffeeff ef 100%);
            background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #ececec), color-stop(100%, #ffeeff ef));
            background: -webkit-linear-gradient(top, #ececec 0%, #ffeeff ef 100%);
            background: -o-linear-gradient(top, #ececec 0%, #ffeeff ef 100%);
            background: -ms-linear-gradient(top, #ececec 0%, #ffeeff ef 100%);
            background: linear-gradient(top, #ececec 0%, #ffeeff ef 100%);
            -moz-box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.1);
            -webkit-box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.1);
            box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.1);
            z-index: 1;
            margin-top:0px !important;
            z-index: 1 !important;
        }
        
        #cssmenu .has-sub {
            z-index: 1;
            padding-left: 50px;
            z-index: 1;
        }
        
        #cssmenu .has-sub:hover > ul {
            display: block;
            z-index: 1;
            padding-left: 50px;/* this value is used to align the menu*/
            z-index: 1;
        }
        
        #cssmenu .has-sub ul {
            display: none;
            position: absolute;
            width: 200px;
            top: 100%;
            left: 0;
            z-index: 1;
        }
        
         #cssmenu .has-sub ul li {
             *margin-bottom: -1px;
             z-index: 1;
             padding-left: 0px; 
             z-index: 1;
         }
        
        #cssmenu .has-sub ul li a {
            background: #a30813;
            border-bottom: 1px dotted #d40a19;
            filter: none;
            font-size: 11px;
            display: block;
            line-height: 120%;
            padding: 10px;
            color: #ffffff;
            top:0;
            z-index: 1;
        }
        
        #cssmenu .has-sub ul li:hover a {
            background: #72060d;
            margin-top:0px !important;
            z-index: 1 !important;
            padding-left:55px;  /*this value moves the text to the left when highlighted*/
        }
        
        #cssmenu .has-sub .has-sub:hover > ul {
            display: block;
            margin-top:0px !important;
            z-index: 1 !important;
            padding-left:0; /* this keeps the sub-menu close to the drop down menu*/
        } 
        
        #cssmenu .has-sub .has-sub ul {
            display: none;
            position: absolute;
            left: 100%;
            top:0;
            z-index: 1;
        }
        
        #cssmenu .has-sub .has-sub ul li a {
            background: #72060d;
            border-bottom: 1px dotted #d40a19;
            padding-left:5px; /* this aligns the txt to the left for the sub-menu */
            z-index: 1;
        } 
        
        #cssmenu .has-sub .has-sub ul li a:hover {
            background: #5a040b;
            margin-top:0px !important;
            z-index: 1 !important;
            padding-left:50px; /* this moves the text on the sub-menu when hovered over*/
        }