如何创建子导航菜单 | 您所在的位置:网站首页 › 子网页怎么设计 › 如何创建子导航菜单 |
/* 导航菜单 */
.navbar { overflow: hidden; background-color: #333;} /* 导航链接 */ .navbar a { float: left; font-size: 16px; color: white; text-align: center; padding: 14px 16px; text-decoration: none;} /* 子导航菜单 */ .subnav { float: left; overflow: hidden;} /* 子导航按钮 */ .subnav .subnavbtn { font-size: 16px; border: none; outline: none; color: white; padding: 14px 16px; background-color: inherit; font-family: inherit; margin: 0;} /* 为悬停时的导航链接添加红色背景颜色 */ .navbar a:hover, .subnav:hover .subnavbtn { background-color: red; } /* 设置子导航内容的样式 - 绝对定位 */ .subnav-content { display: none; position: absolute; left: 0; background-color: red; width: 100%; z-index: 1;} /* 设置子导航链接的样式 */ .subnav-content a { float: left; color: white; text-decoration: none;} /* 在悬停时添加灰色背景颜色 */ .subnav-content a:hover { background-color: #eee; color: black;} /* 当你将鼠标移动到 subnav 容器上时,打开 subnav 内容 */ .subnav:hover .subnav-content { display: block;} |
CopyRight 2018-2019 实验室设备网 版权所有 |