gpt4 book ai didi

html - 按下按钮后如何更改按钮颜色?

转载 作者:行者123 更新时间:2023-11-27 22:48:54 25 4
gpt4 key购买 nike

相关元素:https://vecissitude.github.io/landing-page/

我正在将此着陆页构建为一个元素,但我遇到了按钮问题。一旦你按下它,浏览器就会带你到一个新页面。如果您点击返回,您将返回到起始页面,但按钮的颜色会变为蓝色。这是我在样式表上更改为橙色的 Bootstrap 组件的原始颜色。

如何在按下按钮后更改颜色?我认为它与 :active 伪类有关,所以我在样式表中键入了这段代码,但什么也没做。感谢您的帮助。

.btn-primary:active {
background-color: rgb(255, 68, 0) !important;
border-color:rgb(255, 68, 0) !important;
border-width: 5px;
}

最佳答案

欢迎来到 SO!

这叫做:focus

The :focus selector is used to select the element that has focus.

Tip: The :focus selector is allowed on elements that accept keyboard events or other user inputs.

这是一个例子

.btn-primary:focus {
color: #fff;
background-color: #0069d9;
border-color: #0062cc;
box-shadow: 0 0 0 0.2rem rgba(38,143,255,.5);
}

引用:https://developer.mozilla.org/en-US/docs/Web/CSS/:focus

关于html - 按下按钮后如何更改按钮颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59546982/

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