问题
Is it possible to change font size of the search box in Bootstrap select?
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<select class="selectpicker" data-live-search="true">
<option>Option 1</option>
<option>Option 2</option>
</select>
回答1:
Bootstrap-Select generates some HTML for you, so the thing you want is to inspect the HTML and then write some CSS to override the attributes given by the library.
CSS:
.bs-searchbox > input {
font-size: 20px;
}
This should work for you. Hope this answers your question.
回答2:
Do you mean like this?
.selectpicker{
font-size: 15px !important;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<select class="selectpicker" data-live-search="true">
<option>Option 1</option>
<option>Option 2</option>
</select>
回答3:
If you are using Bootstrap-Select, then you can use the following css:
.filter-option {
font-size: 30px;
}
来源:https://stackoverflow.com/questions/46152433/bootstrap-selectpicker-search-box-font-size