0
我希望这些按钮在点击时保持活动状态,但无法使其工作,并且“currentButton”在页面加载时默认处于活动状态。我可以看到以下样式:点击任一按钮时处于活动状态,但点击后不会保持活动状态。活动按钮不起作用
HTML为2个按钮:
<div class="w3-center invButtons">
<button class="w3-button currentButton">Current</button>
<button class="w3-button pastButton">Past</button>
</div>
CSS:
.w3-button{
border: 2px solid #555555;
background-color: white;
color: black;
padding: 4px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
width: 130px;
border-radius: 8px;
}
.invButtons {
padding-bottom: 16px;
margin: 30px 10px;
}
.w3-button:hover {
color:#000!important;
background-color: gray!important;
}
.w3-button:active {
color:yellow!important;
background-color: yellow!important;
}
可能的重复:https://stackoverflow.com/questions/15463854/pressed-button-css – smrubin
你必须使用按钮吗?并可以使用JavaScript? –
我不必使用按钮,我正在使用jQuery。 – Lilly