gpt4 book ai didi

css - Bootstrap col 3 下拉菜单不显示全宽子菜单

转载 作者:太空宇宙 更新时间:2023-11-04 09:14:29 24 4
gpt4 key购买 nike

我尝试用 CSS 创建一个大型菜单。实际上它在我的导航之外工作得很好。我用 3 列设计我的导航栏。在中间,我放了下拉菜单,但子菜单扩展到 col-lg-6,但我想扩展它。

ul {
list-style: none;
}

li {
display: inline-block;
}

a {
display: block;
padding: 20px;
font-family: sans-serif;
font-size: 2em;
text-decoration: none;
color: grey;
}

a:hover {
background: #efefef;
}



li .sub {
display: none;
width: 100%;
height: auto;
position: absolute;
left: 0;
background:#e5e5e5;
}

li:hover .sub {
display: block;
}
<div class="container">
<div class="row">
<div class="col-lg-3 col-md-8 logo">
LOGO
</div>
<div class="col-lg-6 visible-lg hidden-xs">

<ul>
<li>
<a href="#">Menu 1</a>
<div class="sub">
<div style="width:35%; height:200px; float:left;">
LOGO
</div>
<div style="width:65%; height:200px; float:left;">
SUB MENU WITH SOME CONTENT
</div>
<div style="clear:both;"></div>
</div>
</li>
</ul>
</div>
<div class="col-lg-3 col-md-4 hidden-xs">
<form id="search" name="search" method="get" action="search.php">
<input class="search" type="text" name="tag" id="tag" placeholder="Arama Yap" />
</form>
</div>
</div>
</div>

最佳答案

希望以下内容对您有所帮助:

li .sub {
display: none;
width: 100%;
height: auto;
position: fixed; /* changed to fixed from absolute */
left: 0;
right: 0; /* added to occupy the full width*/
background:#e5e5e5;
}

您可以在此处查看演示:http://www.bootply.com/xnqkM3x4wd

关于css - Bootstrap col 3 下拉菜单不显示全宽子菜单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41857839/

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