gpt4 book ai didi

html - 防止导航栏水平收缩

转载 作者:行者123 更新时间:2023-11-28 06:47:20 24 4
gpt4 key购买 nike

我正在 build 这个网站,但导航栏有一个小问题。我目前有 width=100% 的导航,效果很好,但是当我水平调整浏览器大小时,它会缩小菜单(菜单在那里,但背景被切断)。我希望宽度最初为 100%,并且在浏览器缩小或扩展时根本不调整大小。谁能帮忙?

网站:http://bepas.azurewebsites.net/

下面是我的 CSS。具体行:#cssmenu {height: 50px;宽度:100% ...

html,body {
margin:0;
padding:0;
height:100%;
}


#cssmenu ul { margin: 0; padding: 0; white-space:nowrap;}
#cssmenu li { margin: 0; padding: 0;}
#cssmenu a { margin: 0; padding: 0;}
#cssmenu ul {list-style: none;}
#cssmenu a {text-decoration: none;}
#cssmenu {height: 50px; width:100%;background-color: #708090; box-shadow: 0px 2px 3px rgba(0,0,0,.4); }


#cssmenu > ul > li {

display:inline-block;
margin-left: 65px;
position: relative;
}

#cssmenu > ul > li > a {
color: #FFFFFF;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 18px;
line-height: 50px;
padding: 0px;
-webkit-transition: color .15s;
-moz-transition: color .15s;
-o-transition: color .15s;
transition: color .15s;
}

#cssmenu > ul > li > a:hover {color: #000000; }
body.home li.home, body.tech li.tech {font-weight:bold; }

#cssmenu > ul > li > ul {
opacity: 0;
visibility: hidden;
padding: 0px 0 20px 0;
background-color: #FFFFFF;
text-align: left;
position: absolute;
top: 55px;
left: 50%;
margin-left: -80px;
width: 260px;
-webkit-transition: all .3s .1s;
-moz-transition: all .3s .1s;
-o-transition: all .3s .1s;
transition: all .3s .1s;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
-webkit-box-shadow: 0px 1px 3px rgba(0,0,0,.4);
-moz-box-shadow: 0px 1px 3px rgba(0,0,0,.4);
box-shadow: 0px 1px 3px rgba(0,0,0,.4);
}

#cssmenu > ul > li:hover > ul {
opacity: 1;
top: 50px;
visibility: visible;
}


#cssmenu > ul ul > li { position: relative;}

#cssmenu ul ul a{
color: rgb(50,50,50);
font-family: Verdana, 'Lucida Grande';
font-size: 13px;
background-color: #FFFFFF;
padding: 5px 8px 7px 16px;
display: block;
-webkit-transition: background-color .1s;
-moz-transition: background-color .1s;
-o-transition: background-color .1s;
transition: background-color .1s;
}

#cssmenu ul ul a:hover {background-color: rgb(240,240,240);}

#cssmenu ul ul ul {
visibility: hidden;
opacity: 0;
position: absolute;
top: -16px;
left: 206px;
padding: 16px 0 20px 0;
background-color: rgb(250,250,250);
text-align: left;
width: 160px;
-webkit-transition: all .3s;
-moz-transition: all .3s;
-o-transition: all .3s;
transition: all .3s;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
-webkit-box-shadow: 0px 1px 3px rgba(0,0,0,.4);
-moz-box-shadow: 0px 1px 3px rgba(0,0,0,.4);
box-shadow: 0px 1px 3px rgba(0,0,0,.4);
}


#cssmenu ul ul > li:hover > ul { opacity: 1; left: 196px; visibility: visible;}


#cssmenu ul ul a:hover{
background-color: rgb(205,44,36);
color: rgb(240,240,240);
}

这是我定义菜单的 html 片段。

<div id="cssmenu">
<ul>
<li><a href="#">Sites</a>
<ul>
<li><a href="#">My Sites List</a></li>
<li><a href="#">Site General Info.</a></li>
<li><a href="#">Utility Billing (Electricity)</a></li>
<li><a href="#">Utility Billing (Gas)</a></li>
<li><a href="#">Utility Billing (Solar)</a></li>
<li><a href="#">Occupancy Info.</a></li>
<li><a href="#">Exterior Lighting</a></li>
</ul>
</li>
<li><a href="#">Buildings</a>
<ul>
<li><a href="#">General Info.</a></li>
<li><a href="#">Exterior Lighting</a></li>
<li><a href="#">Roof &amp Exhaust Fans</a></li>
<li><a href="#">HVAC Inventory</a></li>
</ul>
</li>
<li><a href="#">Rooms</a>
<ul>
<li><a href="#">General Info.</a></li>
<li><a href="#">Interior Lighting</a></li>
<li><a href="#">Windows–Envelope Fenestration</a></li>
<li><a href="#">Doors – Envelope Fenestration</a></li>
<li><a href="#">Plugloads</a></li>
<li><a href="#">Skylights – Envelope Fenestration</a></li>
<li><a href="#">Domestic Hot Water Form</a></li>
<li><a href="#">Specialty Kitchen Equipment</a></li>
<li><a href="#">Misc. Inventory</a></li>
</ul>
</li>
<li><a href="#">Runtime Schedulers</a>
<ul>
<li><a href="#">link</a></li>
<li><a href="#">link</a></li>
<li><a href="#">link</a></li>
<li><a href="#">link</a></li>
</ul>
</li>
<li><a href="#">Swimming Pools</a>
<ul>
<li><a href="#">link</a></li>
<li><a href="#">link</a></li>
<li><a href="#">link</a></li>
<li><a href="#">link</a></li>
</ul>
</li>
<li><a href="report.html">Report</a></li>
<li><a href="#">Temperature</a>
<ul>
<li><a href="#">link</a></li>
<li><a href="#">link</a></li>
<li><a href="#">link</a></li>
<li><a href="#">link</a></li>
</ul>
</li>
<li><a href="index.html">Sign in</a></li>
</ul>
</div>

最佳答案

将它放在您的 html 文档(所有 html 文档)的 header 标签中以消除这种奇怪的行为(这解决了我的问题):

<meta name="viewport" content="width=device-width, initial-scale=1.0">

关于html - 防止导航栏水平收缩,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33968926/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com