LOTUSMS
LOTUSMS

Reputation: 10270

bootstrap crossbrowser issues with select control

Bootstrap may be having some issues with the way they render their form select control.

Refer to the picture below to see what I mean.

The code couldn't be any simpler, which tells me that the fix may be outside of Bootstrap itself. This is my code

HTML

  <div class="col-sm-4">
    <select>
       <option>- Jump To -</option>
       <option>Option 1</option>
       <option>Option 2</option>
       <option>Option 3</option>
       <option>Option 4</option>
    </select>
    <button class="btn btn-green btn-go">GO</button>
  </div>

CSS

select {
   color: lighten(@pss-black, 30%);
   -webkit-box-sizing: border-box;
   -moz-box-sizing: border-box;
   box-sizing: border-box;
   width: 230px;
   height: 32px;
   padding: 0 34px 0 10px;
   border: 1px solid lighten(@pss-black, 80%);
  -webkit-border-radius: 0;
   border-top-left-radius: 5px;
   border-top-right-radius: 5px;
   border-bottom-left-radius: 5px;
   border-bottom-right-radius: 5px;
   font-size: 1em;
   background: @pss-white url('@{img-path}bg_select.png') no-repeat 100% 50%;
   -webkit-appearance: none;
   -moz-appearance: none;
   letter-spacing: normal;

}

Anyone knows how to make FF and IE look like Chrome?...If possible, no additional plugins. I am trying to build this with minimal script/images use (mostly pure css in the bootstrap framework)

enter image description here

Upvotes: 2

Views: 3257

Answers (1)

LOTUSMS
LOTUSMS

Reputation: 10270

Well, I figured it out. I hope this helps someone else. Apparently, no one knew this in Dream.in.Code or Codeproject either. Here it goes.

First thing first...You need head.min.js here

Head.js acts as a modernizer, but you can actually identify each browser by its name and tell it that while you are applying a class to an element, you actually want them "separately" to do something different.

This is the isolated code I used for FF and IE *mind you, I am using .less. So adjust accordingly for you CSS front end devs

/* ++++ Styles for IE Browser Compatibility ++++ */
html.ie select {
padding: 4px 5px 4px 10px !important;
background: lighten(@pss-black, 65%) !important;
background:url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2VhZWFlYSIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNmZGZkZmQiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+) !important;
background: -ms-linear-gradient(top,  #eaeaea 0%,#fdfdfd 100%) !important;
background: linear-gradient(to bottom,  #eaeaea 0%,#fdfdfd 100%) !important;
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eaeaea', endColorstr='#fdfdfd',GradientType=0 ) !important;
  }

  /* ++++ Styles for Firefox Compatibility ++++ */
  @-moz-document url-prefix() {
select {
    padding: 4px 5px 4px 10px !important;
   text-indent: 0.01px;
   text-overflow: '';
}
  }

  /* ++++ Removes the alt="..." on top of the image in Firefox ++++ */
    .ui-datepicker-trigger{
    color:transparent;
  }

HAPPY CODING!!

Upvotes: 2

Related Questions