有人知道如何改变Bootstrap的输入:焦点吗?当你点击输入字段时显示的蓝色辉光?


当前回答

如果你想完全移除阴影,添加类shadow-none到你的输入元素中。

其他回答

为什么不直接使用呢?

 input:focus{
        outline-color : #7a0ac5;
    }

你可以这样修改.form-control:focus颜色而不改变引导样式:

快速修复

.form-control:focus {
        border-color: #28a745;
        box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
    } 

完整的解释

Find the bootstrapCDN version that you are using. E.g. for me right now is 4.3.1: https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.css Search for the class you want to modify. E.g. .form-control:focus and copy the parameters that you want to modify into your css. In this case is border-color and box-shadow. Choose a color for the border-color. In this case I choose to pick up the same green the bootstrap uses for their .btn-success class, by searching for that particular class in the bootstrap.css page mentioned in the step 1. Convert the color you have picked to RGB and add that to the box-shadow parameter without altering the fourth RGBA parameter (0.25) that bootstrap has for transparency.

简单的一个

要移除它:

.form-control, .btn {
    box-shadow: none !important;
    outline: none !important;
}

来改变它

.form-control, .btn {
    box-shadow: new-value !important;
    outline: new-value !important;
}

要禁用蓝色辉光(但你可以修改代码来改变颜色,大小等),添加这个到你的css:

.search-form input[type="search"] {  
    -webkit-box-shadow: none;
    outline: -webkit-focus-ring-color auto 0px;
} 

下面是一个屏幕截图,展示了之前和之后的效果:

如果你想完全移除阴影,添加类shadow-none到你的输入元素中。