我已经制作了一个表单,我希望将不同的样式应用于该表单中的特定选择框。
<style>
select#complaintSource
{
@import url("http://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.6.3/css/bootstrap-select.min.css");
@import url("http://netdna.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css");
}
</style>
@if(select)
{
<link href="//netdna.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.6.3/css/bootstrap-select.min.css" />
}
@endif
<form>
<select class="form-control selectpicker" data-show-subtext="true" data-live-search="true" id="complaintSource">
<option>1</option>
<option>2</option>
</select>
</form>
我想将Style应用于此特定选择框。目前,它适用于所有人。
答案 0 :(得分:1)
OP是否有任何理由不能这样做:
<style>
select#complaintSource {
/*enter Bootstrap [select] code only here, such as:*/
display: block;
width: 100px; /*and so on */
/*enter your custom select code here*/
color: green;
}
</style>
其中'在这里输入代码'将包含1)来自Bootstrap的相关行,因为它仅用于选择,2)自定义样式,放在CSS中。
答案 1 :(得分:0)
没有方法我们可以包含样式表仅在视图中选择框。如果您已应用样式表,则必须相应地更改CSS或样式页面。这是唯一的方法。