html - 无法在父 block 旁边的单独 block 中显示子菜单

标签 html css

我必须创建一个嵌套菜单,但我面临的问题是子菜单仅在创建水平滚动条时显示在父菜单中(滚动到最右边你可以看到子菜单) 目前我使用的CSS是

  position: relative;
  list-style: none;
  right: 100%;
  left: auto;
  padding: 10px;
  width: 200px;
  height: 250px;
  overflow-y: scroll;
  display: none;
  text-align: left;
  background-color: #f9f9f9;
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);

https://jsfiddle.net/g0kujLqk/

最佳答案

引用此代码:

  #templatemo_menu
{
clear: both;
width: 960px;
height: 50px;
background: url(../images/templatemo_menu_bg.gif) repeat-x;
   }


   #templatemo_menu ul li{
text-align: center;
display: inline-block;
position: relative;
}

#templatemo_menu ul ul 
{
display: none;
position:absolute;
}

#templatemo_menu ul ul ul
{
left:100%;
top :-10px;

}

#templatemo_menu ul li:hover >ul
{
display:block;
padding:0;
margin-top:5px;
}

关于html - 无法在父 block 旁边的单独 block 中显示子菜单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36687763/

相关文章:

html - CSS 在一个 div 旁边放置一个 div

javascript - 初始化 CSS 链接装饰

css - 如何复制一个小部件的 GTK 样式并将其应用到另一个小部件?

css 背景图像无法正常工作

HTML 仅在 Firefox 上呈现不同

jquery - 沙箱/将 HTML 代码限制在 DIV 标记中

javascript - 如何读取文件的内容并将其附加到字符串中,然后将其添加到 html 中?

html - Firefox 中的闪烁动画

javascript - JQuery下拉菜单三级

Python Mechanize 找不到 login.live.com 表单