有人知道如何改变Bootstrap的输入:焦点吗?当你点击输入字段时显示的蓝色辉光?
当前回答
对于焦点前的输入边框。你可以指定你想要使用的最喜欢的颜色和其他css,如填充等
.input {
padding: 6px 190px 6px 15px;
outline: #2a65ea auto 105px ;
}
当我们关注输入时。你可以指定你喜欢的颜色轮廓
.input:focus{
box-shadow: none;
border-color: none;
outline: lightgreen auto 5px ;
}
其他回答
如果您正在使用Bootstrap 3。X,你现在可以用新的@input-border-focus变量改变颜色。
有关更多信息和警告,请参阅commit。
在_variables。SCSS更新@input-border-focus。
要修改这个辉光的大小/其他部分,请修改mixins/_forms.scss
@mixin form-control-focus($color: $input-border-focus) {
$color-rgba: rgba(red($color), green($color), blue($color), .6);
&:focus {
border-color: $color;
outline: 0;
@include box-shadow(inset 0 1px 1px rgba(0,0,0,.075), 0 0 4px $color-rgba);
}
}
对于焦点前的输入边框。你可以指定你想要使用的最喜欢的颜色和其他css,如填充等
.input {
padding: 6px 190px 6px 15px;
outline: #2a65ea auto 105px ;
}
当我们关注输入时。你可以指定你喜欢的颜色轮廓
.input:focus{
box-shadow: none;
border-color: none;
outline: lightgreen auto 5px ;
}
你可以这样修改.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;
}
这将工作100%使用这个:
.form-control, .form-control:focus{
box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
border: rgba(255, 255, 255, 0);
}