【发布时间】:2019-05-17 13:28:22
【问题描述】:
当我将鼠标悬停在菜单上时,它会转换为删除子菜单,但它无法正常工作。我将下拉菜单的高度设置为 0 像素,当我悬停时,我希望它为 650 像素,因此看起来它正在向下过渡。我需要帮助。
<div class="dropdownform">
<div class="firstdropdown">
<div class="firstblock">Background</div>
<div class="firstblock">Goals</div>
<div class="firstblock">Achievments</div>
</div>
<div class="seconddropdown">
<div class="secondblock">Future</div>
<div class="secondblock">College</div>
<div class="secondblock">Hot 50 Flyer</div>
</div>
<div class="thirddropdown">
<div class="thirdblock">Letter To Freshmen</div>
<div class="thirdblock">Letter of Recommendation</div>
<div class="thirdblock">Scholarship Essay</div>
</div>
</div>
.dropdownform {
display: flex;
flex-direction: row;
position: relative;
left: 5px;
justify-content: space-between;
margin-right: 712px;
bottom: 35px;
}
.firstdropdown {
position: relative;
width: 250px;
height: 0px;
background-color: black;
right: 2.5px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
justify-content: space-around;
border-bottom-right-radius: 35px;
border-bottom-left-radius: 35px;
border-top-right-radius: 12px;
border-top-left-radius: 12px;
overflow: hidden;
}
.seconddropdown {
position: relative;
width: 250px;
height: 0px;
background-color: black;
right: .3px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
justify-content: space-around;
border-bottom-right-radius: 35px;
border-bottom-left-radius: 35px;
border-top-right-radius: 12px;
border-top-left-radius: 12px;
overflow: hidden;
}
.thirddropdown {
position: relative;
width: 250px;
height: 0px;
background-color: black;
left: 1.8px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
justify-content: space-around;
border-bottom-right-radius: 35px;
border-bottom-left-radius: 35px;
border-top-right-radius: 12px;
border-top-left-radius: 12px;
overflow: hidden;
}
.firstblock {
position: relative;
width: 200px;
height: 50px;
background-color: white;
border-radius: 35px;
display: flex;
justify-content: center;
align-items: center;
}
.secondblock {
position: relative;
width: 200px;
height: 50px;
background-color: white;
border-radius: 35px;
display: flex;
justify-content: center;
align-items: center;
}
.thirdblock {
position: relative;
width: 200px;
height: 50px;
background-color: white;
border-radius: 35px;
display: flex;
justify-content: center;
align-items: center;
}
.first:hover + .firstdropdown {
height: 650px;
transition: .5s ease-in-out;
}
这是一张参考图片:image
我知道这可能是重复的,但我没有找到适合我的情况。
【问题讨论】:
-
您使用的是
.first,但没有名为.first的类,是我们遗漏了一些代码还是您的代码错误? -
学习一些像this one on W3C schools这样的好教程怎么样?
-
srry 无法添加整个代码,但有一个 .first,这里是:
第二第三 -
@AltafAria 你能用你必须的所有代码制作一个 jsfiddle 吗?在这里找到 jsfiddle
www.jsfiddle.net -
jsfiddle.net/h1we45rq srry 我是新手
标签: html css drop-down-menu hover submenu