css设置前一个兄弟节点

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;
}
  • >
  • 你可能感兴趣的:(HTML,css)