gpt4 book ai didi

html - 导航栏中的链接不会将我带到下一页,而是消失了

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

我对它进行了焦点转换。通常当我点击页面上的其他地方时它会消失,但是当我点击下拉菜单中的一个链接时它也会消失!在我再次单击导航栏中的按钮之前,如何保持它可见!?

CSS:

.nav-item:focus {
background-color: #444;
}

.nav-item:focus ~ .nav-content {
max-height: 400px;
-webkit-transition:max-height 400ms ease-in;
-moz-transition:max-height 400ms ease-in;
transition:max-height 400ms ease-in;


}

最佳答案

.nav-item 是表单元素吗?否则选择器 focus 将无法使用它,您应该为此使用 javascript。此外,您不需要在 .nav-item:focus ~ .nav-content 中使用此“~”:

.nav-item:visited .nav-content {
max-height: 400px;
-webkit-transition: max-height 400ms ease-in;
-moz-transition: max-height 400ms ease-in;
transition: max-height 400ms ease-in;
}

关于html - 导航栏中的链接不会将我带到下一页,而是消失了,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27880404/

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