Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap select menu styling

I am trying to give my <select> menu a custom color and padding. As of now, It looks like this:

enter image description here

select {
  display: block;
  margin: 0 auto;
  background-color: #2A3F54;
}
<select name="ad_account_selected" onchange="this.form.submit()" class="selectpicker" data-style="btn-primary">
  <option>Mustard</option>
  <option>Ketchup</option>
  <option>Relish</option>
</select>

I want a small gap between the menus and the left side and give it the color of my sidebar ( seen around the menu above ). However, the button remains in the default color and even if I add padding-left: 20px the menu is stuck to the left side. Any help?

like image 523
Beginner Avatar asked Dec 13 '25 08:12

Beginner


1 Answers

Change your data-style to btn-new like this:

<select data-style="btn-new">
    ....
</select>

And then style that button like this:

.btn-new {
    background-color: #2A3F54;
}

Link to CodePen: http://codepen.io/anon/pen/pyBjrr

like image 72
AndrewL64 Avatar answered Dec 15 '25 00:12

AndrewL64