gpt4 book ai didi

html - 为什么我不能悬停以下固定元素?

转载 作者:行者123 更新时间:2023-11-28 12:39:52 25 4
gpt4 key购买 nike

举例说明:

enter image description here

.chapter-list 的 CSS:

.chapter-list,
.chapter-actions,
.chapter-words,
.current-book-actions {
visibility: hidden;
}
.chapter-list:hover,
.chapter-actions:hover,
.chapter-words:hover,
.current-book-actions:hover {
visibility: visible;
}
.chapter-list {
width: 200px;
position: fixed;
left: 30px;
top: 30px;
}

无论我使用什么 z-index,我都无法悬停在 .chapter-list 上。 .container 根本没有任何 CSS,所以我不确定是什么导致了这个问题。

编辑:

这是 .chapter-form 的 CSS:

.chapter-form {
margin: 30px auto 0;
width: 45%;
max-width: 640px;
}

但不确定它会如何影响悬停。

最佳答案

你不能悬停它,因为你已经用 visiblity: hidden 隐藏了它。

.chapter-list,
.chapter-actions,
.chapter-words,
.current-book-actions {
visibility: hidden;
}

隐藏的元素仍然占据文档中的空间,但您看不到它们或与它们交互。这就是为什么您仍然可以在开发人员工具中看到该元素正在使用的空间。

编辑 - 假设您希望元素最初隐藏,然后让它在悬停时出现(这看起来是一个非常奇怪的交互),您可以这样做:

.chapter-list,
.chapter-actions,
.chapter-words,
.current-book-actions {
opacity: 0;
}

.chapter-list:hover,
.chapter-actions:hover,
.chapter-words:hover,
.current-book-actions:hover {
opacity: 1;
}

关于html - 为什么我不能悬停以下固定元素?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26655300/

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