在下面给出的代码中,当我选择'apps'下拉菜单时,它会隐藏下面的数据(即,它隐藏'layout'和'widjet')。我需要用下拉效果显示数据。你帮我?
#first {
float:left;
width:15%;
color :bisque;
border-color: #023b3b;
border-style : solid;
height: 100%;
background-color :#023b3b;
}
#boa{
height: 5%;
width: 20%;
float: left;
}
.bob{
text-indent: 200%;
line-height: 210%;
font-size: 150%;
font-family: sans-serif;
color: white;
font-weight: bold;
}
.boc{
text-indent: 4%;
color : white;
font-size: 83%;
font-family: sans-serif;
font-weight: normal;
}
.bod{
color:white;
font-size: 100%;
font-family: sans-serif;
line-height: 200%;
list-style-type: none;
}
#demo {
margin: 30px 0 50px 0;
font-family: sans-serif;
}
#demo .wrapper {
display: inline-block;
width: 180px;
/* margin: 0 10px 0 0;*/
height: 20px;
position: relative;
}
#demo .parent {
height: 100%;
width: 100%;
display: block;
cursor: pointer;
line-height: 30px;
height: 30px;
/* border-radius: 5px;*/
background: #023b3b;
border: 1px solid #023b3b;
border-bottom: 1px solid #023b3b;
color: white;
/* font-weight: bold;*/
z-index: 2;
position: relative;
-webkit-transition: border-radius .1s linear, background .1s linear, z-index 0s linear;
-webkit-transition-delay: .2s;
text-align: center;
}
#demo .parent:hover,
#demo .content:hover ~ .parent {
background: #122112;
-webkit-transition-delay: 0s, 0s, 0s;
}
#demo .content:hover ~ .parent {
/* border-bottom-left-radius: 0;
border-bottom-right-radius: 0;*/
z-index: 0;
}
#demo .content {
position: absolute;
top: 0;
display: block;
z-index: 1;
height: 0;
width: 180px;
padding-top: 30px;
-webkit-transition: height .2s ease;
-webkit-transition-delay: .4s;
border: 1px solid #339933;
/* border-radius: 5px;*/
/*box-shadow: 0 1px 2px rgba(0,0,0,.4);*/
}
#demo .wrapper:active .content {
height: 100px;
z-index: 3;
-webkit-transition-delay: 0s;
}
<html>
<head>
<title> PROJECT </title>
<link rel="stylesheet" type="text/css" href="stack.css">
</head>
<body>
<div id="first" style="float:left; lngth:60%; ">
<p><img src="image1.jpg" id="boa"><span class="bob">First</span></p>
<p class="boc" >Main</p>
<div id="demo">
<div class="wrapper">
<div class="parent">Dashboard</div>
</div><br> <br>
<div class="wrapper">
<div class="content">
<ul>
<a href="#"><li>Inbox</li></a>
<a href="#"><li>Condact</li></a>
<a href="#"><li>Calender</li></a>
<a href="#"><li>Other</li></a>
</ul>
</div>
<div class="parent">Apps</div>
</div><br><br>
<div class="wrapper">
<div class="content">
<ul>
<a href="#"><li>Header</li></a>
<a href="#"><li>Aside</li></a>
<a href="#"><li>Footer</li></a>
<a href="#"><li>Other</li></a>
</ul>
</div>
<div class="parent">Layouts</div>
</div><br><br>
<div class="wrapper">
<div class="parent">Widjet</div>
</div>
</div>
<p class="boc">Componets</p>
<p class="boc">Help</p>
<p class="bod"> Documents</p>
</div>
</body>
</html>
#demo .content:hover {
height: 123px;
z-index: 3;
-webkit-transition-delay: 0s;
}
#demo .content ul {
background: #339933;
margin: 0;
padding: 0;
overflow: hidden;
height: 100%;
}
#demo .content ul a {
text-decoration: none;
}
#demo .content li:hover {
background: #122112;
color: white;
}
#demo .content li {
list-style: none;
text-align: left;
color: white;
font-size: 14px;
line-height: 30px;
height: 30px;
padding-left: 10px;
border-top: 1px solid #023b3b;
}
在上面的代码中,当我选择“apps”下拉菜单时,它会隐藏下面的数据(即,它隐藏'layout'和'widjet')。我需要显示带有下拉效果的数据。帮我?
我可以给你一些重要的提示。首先,你想从position: absolute
选择器中删除#demo .content
。此外position: relative;
在position: absolute;
选择器中进入#demo .parent
。
这将允许整个菜单在需要更多内容时扩展。
在您的UL css中添加css属性
#demo .content ul {
background: #339933;
margin: 0;
padding: 0;
overflow: hidden;
height: 100%;
z-index: 999; // add this in your css
}
尝试css崩溃,我认为这是你需要的css collapse