gpt4 book ai didi

html - 向左下拉的定位

转载 作者:太空宇宙 更新时间:2023-11-04 03:35:33 24 4
gpt4 key购买 nike

我正在尝试创建 3 - tire 下拉菜单。我将第三级子菜单定位到父菜单的左侧,但顶部位置没有正确对齐。

屏幕下方是我得到的结果。

CSS 代码:

/* the menu_new_new is the list, you don't need a wrapping div */
#menu_new{
Text-Align: Left;
/*width:100%;*/
background:#194eb1;
/* height:30px;*/
}

/* only mainmenu_new listitems */
#menu_new > li{
display:inline-block;
position:relative;
line-height:35px;
}

/* links in mainmenu_new and both submenu_news */
#menu_new a{
display:block;
text-decoration:none;
padding:0px 10px;
color:#fff;
text-align:Left;
}

/* submenu_news of both levels */
#menu_new li ul{
position: absolute;
top: 35px;
left:0;
min-width:150px;
background: #194eb1;
Text-Align: Left;


}
/* submenu text */
#menu_new li ul li{

Text-Align: Left;
line-height:20px;
List-style-type:none;
border: 1px solid white;
}
/* move the second level submenu_new to the right to don't overlap the parent submenu_new */
#menu_new ul ul{
position: absolute;
top:auto;
left:150px;
Z-index: 10;

}

/* hover effect for submenu_new links */
#menu_new li li a:hover{
background:rgba(255,255,255,0.5);
}

/* hide all submenu_news for default */
#menu_new li ul{
display: none;
}

/* show a submenu_new if the direct parent listitem is hovered */
#menu_new li:hover > ul{
display:block;
}

如何使顶部位置与父菜单位置完全对齐?

示例代码请引用:http://jsfiddle.net/asovbLqd/

Result screen

最佳答案

请查网址 enter link description here

#menu_new ul ul{
top:0px;
}
#menu_new li ul li{
position:relative;
}

关于html - 向左下拉的定位,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25625924/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com