我正在创建大型下拉菜单。这一切都是由 HTML 和 CSS 完成的。我的问题是,当您选择其中一个 LI 时,它会以牺牲其他 LI 为代价而最大化。
我不知道应该是哪里的问题,你能给我一个如何解决的建议吗?
HTML
<div id="wrapper">
<div id="menu2">
<ul id="menu2_ul">
<li class="list"><a href="#">Domů</a>
<div class="sub">
<div class="submenu">
<ul class="submenu_left_menu">
<li><a href="#">Domů</a></li>
<li><a href="#">Pojištění</a></li>
<li><a href="#">Půjčky</a></li>
<li><a href="#">Hypotéky</a></li>
<li><a href="#">Účty a spoření</a></li>
<li><a href="#">Energie</a></li>
<li><a href="#">Investice</a></li>
<li><a href="#">Slevy</a></li>
</ul>
</div>
<div class="submenu_content">
<h2>Lorem ipsum</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean placerat risus leo, id placerat massa malesuada in. Vestibulum venenatis diam vel cursus dignissim. Aenean ac leo nunc. Fusce erat mauris, commodo at faucibus non, eleifend id nibh. Aliquam non ligula dignissim, venenatis nisi in, lacinia velit. Maecenas pharetra urna metus, nec dictum mauris suscipit et. Donec posuere massa vitae magna tempus, eu interdum nulla consectetur. Mauris consequat fringilla turpis, eu venenatis felis viverra sed. Fusce a placerat lectus. Sed vel sem sodales, eleifend nunc ac, viverra felis. Donec egestas ante nec enim semper dictum. Aenean mollis sodales lorem, sed pharetra leo sollicitudin id. Cras nulla neque, gravida nec rutrum sed, mattis quis nisl. Duis vulputate tempus diam eget tincidunt. Nunc elementum eu ante iaculis laoreet.</p>
</div>
<div class="submenu_poll">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean placerat risus leo, id placerat massa malesuada in. Vestibulum venenatis diam vel cursus dignissim. Aenean ac leo nunc. Fusce erat mauris, commodo at faucibus non, eleifend id nibh. Aliquam non ligula dignissim, venenatis nisi in, lacinia velit. Maecenas pharetra urna metus, nec dictum mauris suscipit et. Donec posuere massa vitae magna tempus, eu interdum nulla consectetur. Mauris consequat fringilla turpis, eu venenatis felis viverra sed. Fusce a placerat lectus. Sed vel sem sodales, eleifend nunc ac, viverra felis. Donec egestas ante nec enim semper dictum. Aenean mollis sodales lorem, sed pharetra leo sollicitudin id. Cras nulla neque, gravida nec rutrum sed, mattis quis nisl. Duis vulputate tempus diam eget tincidunt. Nunc elementum eu ante iaculis laoreet.</p>
</div>
</div>
</li>
<li class="list"><a href="#">Pojištění</a>
<div class="sub">
<div class="submenu">
<ul class="submenu_left_menu">
<li><a href="#">Domů</a></li>
<li><a href="#">Pojištění</a></li>
<li><a href="#">Půjčky</a></li>
<li><a href="#">Hypotéky</a></li>
<li><a href="#">Účty a spoření</a></li>
<li><a href="#">Energie</a></li>
<li><a href="#">Investice</a></li>
<li><a href="#">Slevy</a></li>
</ul>
</div>
<div class="submenu_content">
</div>
<div class="submenu_poll">
</div>
</div>
</li>
</div>
</div>
CSS
body {
background-color: black;
padding: 0px;
margin: 0px;
}
#wrapper {
margin: 0px;
padding: 0px;
height: 40px;
background-color: white;
}
#menu2 {
width: 981px;
margin: 0 auto;
padding: 0px;
}
#menu2 ul {
list-style: none;
display: table;
margin: 0px;
padding: 0px;
height: 40px;
}
#menu2 li.list {
display: table-cell;
line-height: 40px;
border-left: 1px solid grey;
position: relative;
}
#menu2 div.sub {
margin:0;
display:none;
background-color: white;
}
#menu2 li.list:hover div.sub {
display: block !important;
width: 981px !important;
}
/******************************************************************************\
\******************************************************************************/
#menu2 div.sub .submenu {
float: left;
width: 220px;
}
#menu2 div.sub .submenu_content {
width: 550px;
float: left;
}
#menu2 div.sub .submenu_poll {
}