Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个带有悬停下拉菜单的导航栏。就在它的底部,我有一个相对定位的文本。将触发器悬停在导航栏上时,下拉菜单会下降,但不会隐藏相关文本,文本仍会显示在下拉菜单上方。
我知道hide()悬停时可以使用 jquery 触发,但是有纯 CSS 方法吗?
hide()
定位元素( 、 和 )的relative堆叠absolute顺序fixed用 设置z-index。
relative
absolute
fixed
z-index
z-index: 10为导航栏和z-index: 5文本设置。
z-index: 10
z-index: 5
当然,这些数字 (5,10) 是任意的,重要的是 5 < 10