html - 子菜单的水平滚动动作
问题描述
我想在移动视图中为我的网站创建一个水平滚动菜单。我从某个地方获得了 CSS 代码,它可以工作,但它仅适用于菜单。所以,我也想要子菜单的 CSS 代码。我怎样才能做到这一点?
下面列出了适用于水平滚动菜单的 CSS 代码:
selector ul{ /* let's set the horizontal layout for our menu */
white-space: nowrap;
overflow-x: auto;
overflow-y: hidden;
flex-wrap: inherit !important;
scrollbar-width: none; /* this will remove scroll-bar for mozilla based browser */
}
selector a{ /* some graphic adjustmend for the A tag */
background: #161C2E;
border-radius: 0px;
}
selector ul::-webkit-scrollbar { /* now, let's remove the scroll-bar from the menu */
display: none; }
解决方案
由于 wordpress 中的子菜单通常是ul
another 的内部ul
,因此您也可以定位这些元素:
selector ul, selector ul ul {
white-space: nowrap;
overflow-x: auto;
overflow-y: hidden;
flex-wrap: inherit !important;
scrollbar-width: none;
}
推荐阅读
- css - 使用 Typescript 有条件地应用 css 在 React JS 中不起作用
- python - “没有这样的文件或目录:”使用 pyglet
- python - Pandas 新列使用方程
- python - 每次按下按钮时如何向下移动图像Tkinter
- php - Laravel 8 应用程序在网络服务器上显示空白页面
- javascript - 有没有办法使用 vanilla JS 将模块函数中的 JS 变量导出到另一个文件?
- c++ - Qt with visual studio , Qt 需要 c++17 编译器
- javascript - 如何从特定索引开始循环遍历数组(对象数组)并在Javascript中更改对象中的属性?
- python - PySpark:RDD如何减少字典列表上的关键字?
- youtube-api - Youtube 数据 API 活动端点不返回任何项目