And*_*Koh 5 html css bootstrap-4
<select>聚焦后如何禁用边框突出显示(轮廓)。我可以禁用它像其他元素<input>,<textarea>,<button>而不是<select>标签。
这是我的CSS,我确实包含了select:focus它,但是它不起作用。:(
input:focus,
select:focus,
option:focus,
textarea:focus,
button:focus {
outline: none;
}
Run Code Online (Sandbox Code Playgroud)
这是代码段:
input:focus,
select:focus,
option:focus,
textarea:focus,
button:focus {
outline: none;
}
Run Code Online (Sandbox Code Playgroud)
input:focus,
select:focus,
textarea:focus,
button:focus {
outline: none !important;
}
body {
padding: 40px 20px 20px 20px;
}
.qa-collapse {
background-color: rgb(245, 245, 245);
}
.qa-input {
border-top-left-radius: 50px;
border-bottom-left-radius: 50px;
border-right: none !important;
border: 1px solid #F2F2F2;
width: 82%;
padding: .25rem .75rem;
font-size: 1rem;
line-height: 1.5;
color: #495057;
background-color: #fff;
background-image: none;
background-clip: padding-box;
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
}
.qa-search {
border-top-right-radius: 50px;
border-bottom-right-radius: 50px;
background-color: #E01E34;
border: 1px solid #E01E34;
padding: .2rem .75rem;
}
input[type="text"].qa-input::-webkit-input-placeholder {
color: ;
font-size: 80%;
font-family: PosLight;
}
.qa-search img {
margin-top: -3px;
}
.qa-form-inline {
display: -ms-flexbox;
display: flex;
-ms-flex-flow: row wrap;
flex-flow: row wrap;
-ms-flex-align: center;
align-items: center;
}
.qa-track-trace p {
font-family: PosLight;
font-size: 12px;
padding: 0 2.6rem 0 0.7rem;
color: #999999;
}
.nav-tabs {
border: 0px;
}
.nav-tabs .nav-link.active {
border: 0px;
border-top-right-radius: 0;
border-top-left-radius: 0;
background-color: transparent;
border-color: transparent;
}
.nav-tabs .nav-link:hover {
border-color: transparent;
}
.nav-tabs .nav-link {
border: 0px;
border-top-right-radius: 0px;
border-top-left-radius: 0px;
background-color: transparent;
}
.qa-send-lp-tab {
color: rgba(0, 0, 0, .5);
display: block;
padding: 0rem 1rem;
}
.qa-send-lp-tab:hover {
color: rgba(0, 0, 0, .7);
}
.qa-send-lp-tab.active {
color: #E11F34 !important;
}
.qa-track-trace p {
font-family: PosLight;
font-size: 12px;
padding: 0 2.6rem 0 0.7rem;
color: #999999;
}
.qa-input-full {
border-radius: 50px;
border: 1px solid #F2F2F2;
width: 100%;
padding: .25rem .75rem;
font-size: 1rem;
line-height: 1.5;
color: #495057;
background-color: #fff;
background-image: none;
background-clip: padding-box;
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
}
input[type="text"].qa-input-full::-webkit-input-placeholder {
color: ;
font-size: 80%;
font-family: PosLight;
}
input[type="text"].qa-input-full::-webkit-input-placeholder {
color: ;
font-size: 80%;
font-family: PosLight;
}
.qa-dropdown {
border-top-right-radius: 50px;
border-bottom-right-radius: 50px;
background-color: #E01E34;
border: 1px solid #E01E34;
padding: .20rem .75rem;
}
.qa-dropdown img {
margin-top: -3px;
}
select.form-control {
-webkit-appearance: none;
-moz-appearance: none;
background: url("data:image/svg+xml;utf8,<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='18' height='18' viewBox='0 0 24 24'><path fill='grey' d='M7.406 7.828l4.594 4.594 4.594-4.594 1.406 1.406-6 6-6-6z'></path></svg>") #fff;
/* background: url(../img/dropdown-2.svg); */
/* background: url(../img/dropdown.svg); */
/*background-position: 91.5% 50%; */
background-position: 95% 50%;
background-repeat: no-repeat;
}
select.form-control:not([size]):not([multiple]) {
height: 35px;
border: 1px solid #F2F2F2;
border-radius: 50px;
border: 1px solid #F2F2F2;
width: 100%;
padding: .25rem .75rem;
line-height: 1.5;
color: #495057;
background-color: #fff;
background-clip: padding-box;
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
}
.styled-select {
font-size: 12px;
font-family: 'PosLight';
}Run Code Online (Sandbox Code Playgroud)
正如我所猜测的,这是由于引导程序样式:
.form-control:focus /* => from bootstrap css */
{
...
outline: 0;
box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25); /* => this cause the highlight! */
}
Run Code Online (Sandbox Code Playgroud)
它为 设置了一个框阴影.form-control:focus。你必须在你的 css 中覆盖它:
.form-control:focus /* => from bootstrap css */
{
...
outline: 0;
box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25); /* => this cause the highlight! */
}
Run Code Online (Sandbox Code Playgroud)
input:focus,
select:focus, .form-control:focus,
textarea:focus,
button:focus {
outline: none !important;
box-shadow: none !important;
}
body {
padding: 40px 20px 20px 20px;
}
.qa-collapse {
background-color: rgb(245, 245, 245);
}
.qa-input {
border-top-left-radius: 50px;
border-bottom-left-radius: 50px;
border-right: none !important;
border: 1px solid #F2F2F2;
width: 82%;
padding: .25rem .75rem;
font-size: 1rem;
line-height: 1.5;
color: #495057;
background-color: #fff;
background-image: none;
background-clip: padding-box;
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
}
.qa-search {
border-top-right-radius: 50px;
border-bottom-right-radius: 50px;
background-color: #E01E34;
border: 1px solid #E01E34;
padding: .2rem .75rem;
}
input[type="text"].qa-input::-webkit-input-placeholder {
color: ;
font-size: 80%;
font-family: PosLight;
}
.qa-search img {
margin-top: -3px;
}
.qa-form-inline {
display: -ms-flexbox;
display: flex;
-ms-flex-flow: row wrap;
flex-flow: row wrap;
-ms-flex-align: center;
align-items: center;
}
.qa-track-trace p {
font-family: PosLight;
font-size: 12px;
padding: 0 2.6rem 0 0.7rem;
color: #999999;
}
.nav-tabs {
border: 0px;
}
.nav-tabs .nav-link.active {
border: 0px;
border-top-right-radius: 0;
border-top-left-radius: 0;
background-color: transparent;
border-color: transparent;
}
.nav-tabs .nav-link:hover {
border-color: transparent;
}
.nav-tabs .nav-link {
border: 0px;
border-top-right-radius: 0px;
border-top-left-radius: 0px;
background-color: transparent;
}
.qa-send-lp-tab {
color: rgba(0, 0, 0, .5);
display: block;
padding: 0rem 1rem;
}
.qa-send-lp-tab:hover {
color: rgba(0, 0, 0, .7);
}
.qa-send-lp-tab.active {
color: #E11F34 !important;
}
.qa-track-trace p {
font-family: PosLight;
font-size: 12px;
padding: 0 2.6rem 0 0.7rem;
color: #999999;
}
.qa-input-full {
border-radius: 50px;
border: 1px solid #F2F2F2;
width: 100%;
padding: .25rem .75rem;
font-size: 1rem;
line-height: 1.5;
color: #495057;
background-color: #fff;
background-image: none;
background-clip: padding-box;
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
}
input[type="text"].qa-input-full::-webkit-input-placeholder {
color: ;
font-size: 80%;
font-family: PosLight;
}
input[type="text"].qa-input-full::-webkit-input-placeholder {
color: ;
font-size: 80%;
font-family: PosLight;
}
.qa-dropdown {
border-top-right-radius: 50px;
border-bottom-right-radius: 50px;
background-color: #E01E34;
border: 1px solid #E01E34;
padding: .20rem .75rem;
}
.qa-dropdown img {
margin-top: -3px;
}
select.form-control {
-webkit-appearance: none;
-moz-appearance: none;
background: url("data:image/svg+xml;utf8,<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='18' height='18' viewBox='0 0 24 24'><path fill='grey' d='M7.406 7.828l4.594 4.594 4.594-4.594 1.406 1.406-6 6-6-6z'></path></svg>") #fff;
/* background: url(../img/dropdown-2.svg); */
/* background: url(../img/dropdown.svg); */
/*background-position: 91.5% 50%; */
background-position: 95% 50%;
background-repeat: no-repeat;
}
select.form-control:not([size]):not([multiple]) {
height: 35px;
border: 1px solid #F2F2F2;
border-radius: 50px;
border: 1px solid #F2F2F2;
width: 100%;
padding: .25rem .75rem;
line-height: 1.5;
color: #495057;
background-color: #fff;
background-clip: padding-box;
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
}
.styled-select {
font-size: 12px;
font-family: 'PosLight';
}Run Code Online (Sandbox Code Playgroud)