0

I am trying to remove border color from options of a select box from bootstrap multiselect, but unable to find any class which is adding a blue color around the border of the options.

This border comes when you click on the option or you put it into focus, here is what I have tried

HTML

<body>
    <select size="5" name="lstStates" multiple="multiple" id="lstStates">
        <option value="NJ">New Jersey</option>
        <option value="NY">New York</option>
        <option value="OH">Ohio</option>
        <option value="TX">Texas</option>
        <option value="PA">Pennsylvania</option>
        <option value="GG">asdfa</option>
        <option value="AW">jghjh</option>
        <option value="AE">qwer</option>
    </select>   
</body>

jquery

$(function () { 
    $('#lstStates').multiselect({ 
        buttonText: function(options, select) {
            console.log(select[0].length);
            if (options.length === 0) {
                return 'None selected';
            }
            if (options.length === select[0].length) {
                return 'All selected ('+select[0].length+')';
            }
            else if (options.length >=10) {
                return options.length + ' selected';
            }
            else {
                var labels = [];
                console.log(options);
                options.each(function() {
                    labels.push($(this).val());
                });
                return labels.join(', ') + '';
            }
        }

    });
});

css

.dropdown-menu>.active>a, .dropdown-menu>.active>a:hover, .dropdown-menu>.active>a:focus {
    color: #20262e;
    text-decoration: none;
    background-color: rgba(255,255,255,0.15);
    outline: 0;
}

.dropdown-menu>li>a:hover, .dropdown-menu>li>a:focus {
    color: #262626;
    text-decoration: none;
    background-color: rgba(255,255,255,0.15);
}

FIDDLE

enter image description here

freedomn-m
  • 27,664
  • 8
  • 35
  • 57
saurabh kumar
  • 45
  • 1
  • 10
  • 1
    http://www.outlinenone.com/ By removing this you're actively making your site less accessible. – Roope Nov 23 '18 at 12:56
  • See If this question answered your problem. https://stackoverflow.com/questions/492627/change-border-color-on-select-html-form – Subramaniam Chintamani Nov 23 '18 at 12:56
  • Possible duplicate of [How to remove the border highlight on an input text element](https://stackoverflow.com/questions/1457849/how-to-remove-the-border-highlight-on-an-input-text-element) – Smollet777 Nov 23 '18 at 12:59

6 Answers6

4

The blue is caused by the user-agent stylesheet:

:focus {
    outline: -webkit-focus-ring-color auto 5px;
}

you can override it just on your dropdown with:

ul.multiselect-container li a:focus
{
    outline-color: white;
}

Updated fiddle: http://jsfiddle.net/76wdfrbm/

freedomn-m
  • 27,664
  • 8
  • 35
  • 57
0

I added outline: 0; to .dropdown-menu>li>a:hover, .dropdown-menu>li>a:focus and it worked

 .dropdown-menu>li>a:hover, .dropdown-menu>li>a:focus {
    color: #262626;
    text-decoration: none;
    background-color: rgba(255,255,255,0.15);
}
saurabh kumar
  • 45
  • 1
  • 10
0

Please add this CSS in your code:

.dropdown-menu>li>a label:focus{outline: none}
.dropdown-menu>li>a:focus{outline: none}
Joykal Infotech
  • 1,840
  • 3
  • 9
  • 17
0

by default, the browser use this style

  :focus {
    outline: -webkit-focus-ring-color auto 5px;
}

you can override the elements

.multiselect-container>li>a>label.checkbox:focus{
    outline:0 !important;
 }
Fahd Allebdi
  • 354
  • 4
  • 7
0

try this

a,a:focus{
    outline:none;
}

this will remove focus border

-1

you should apply below style:

<style>
.dropdown-menu>li>a:hover, .dropdown-menu>li>a:focus {
outline:none;
}
</style>
AddWeb Solution Pvt Ltd
  • 21,025
  • 5
  • 26
  • 57