css需求分析:鼠標移到“企業采購”改變顏色 有個下拉框 解決思路:對於相鄰節點少的情況下可以將節點書寫順序顛倒,然後在有排序就好啦,
#head_enter{
position: relative;
}
#enter{
text-align: center;
height: 31px;
padding: 0 8px;
border: 1px solid transparent;
box-sizing: border-box;
position: relative;
}
#enter_open{
width: 156px;
height: 95px;
margin-top: 30px;
position: absolute;
border: 1px solid #ccc;
border-top: none;
display: none;
}
#enter:hover{
background-color: white;
border: 1px solid #ccc;
border-bottom: none;
}
#enter_parent{
position: relative;
}
#enter_parent:hover>#enter_open{
display: block;
}
#enter_open:hover+#enter{
border: 1px solid #ccc;
border-bottom: none;
background-color: white;
}
#foot_enter{
position: relative;
}
#enter_li1{
display: block;
display: flex;
justify-content: space-between;
padding: 0 15px;
box-sizing: border-box;
}
#enter_li2{
display: block;
display: flex;
justify-content: space-between;
padding: 0 40px 0 15px;
box-sizing: border-box;
}
<li id="head_enter">
<div id="enter_parent">
<div id="enter_open">
<ul id="foot_enter">
<div id="enter_li1">
<li class="enter_li"><a href="">企業購</a></li>
<li class="enter_li"><a href="">商用場景館</a></li>
</div>
<div id="enter_li2">
<li class="enter_li"><a href="">工業品</a></li>
<li class="enter_li"><a href="">禮品卡</a></li>
</div>
<div id="enter_li1">
<li class="enter_li"><a href="">豐客多商城</a></li>
</div>
</ul>
</div>
<div id="enter">
<a class="color_red" href="">企業采購</a>
</div>
</div>
</li>