user8531037
user8531037

Reputation:

How to apply style-sheet only to a particular select box in form in laravel?

I have made a form in which I want to apply a different style to a particular Select Box in that form.

 <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>

I want to apply the Style to this particular Select Box . At the moment it is applying to all of them.

Upvotes: 0

Views: 323

Answers (2)

user8531037
user8531037

Reputation:

There is no method that We Can Include Style Sheet to only select box in View. If you have applied the Style Sheet then you have to change CSS or Style your page accordingly. That's the only way.

Upvotes: 0

Ashwin Anandani
Ashwin Anandani

Reputation: 344

Is there any reason that the OP here can't just do:

<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>

Where 'enter code here' would have 1) the relevant lines from Bootstrap, since it's only for select, and 2) the custom styles for it, placed inside as CSS.

Upvotes: 1

Related Questions