【发布时间】:2019-10-16 10:15:36
【问题描述】:
我目前正在使用类为 .btn-outline-primary 的 Bootstrap 4.1 按钮。在其常规状态下,该按钮具有带有蓝色文本的白色背景。但是,当您将鼠标悬停在按钮上时,颜色会反转,使得背景为蓝色,文本为白色。
此按钮的活动状态只是一个突出显示的边框(按钮样式与非活动状态相同 - 白色背景蓝色文本),我想这样做,以便在单击按钮时,按钮保持不变按钮悬停时的样式。
但是,我无法访问按钮的悬停类,因为它是一个引导按钮,我想知道如何实现这一点?这是按钮:
<button class='btn btn-outline-primary max-w-250 mx-1 my-1' type='button' id='MyButton' name='happyButton'>
<div class='d-flex flex-column justify-content-center align-items-center overflow-none'>
<div class='ButtonText line-height-16'>"Text Line One"</div>
</div>
</button>
我曾尝试使用 css 样式,使用 :focus 来更改背景颜色,但是,这只是过度使用文本,因为文本不会反转并且背景现在与文本颜色匹配。
.btn-outline-primary:focus{
background-color: #18f;
}
【问题讨论】:
标签: html css bootstrap-4