简体   繁体   中英

Padding not working for SELECT OPTION in IE11

~I have created listbox control and trying to add padding between options, It is working with chrome but not working with IE11, Anyone can suggest what I am doing wrong.I need to place items in the listbox with line spacing. Below code contains style sheet I am using and HTML code which has select options tag, Tried styles with padding, margin, line space etc but no luck.

 <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>change demo</title> <style> div { color: red; } </style> <style type="text/css"> select::-ms-expand { /* for IE 11 */ display: none; } .ListBox { background-color: transparent; font-family: verdana; font-size: 8pt; font-weight: bold; color: black; vertical-align:middle; } .ListBox option { padding:30px 30px 30px 30px; -webkit-appearance: none; -moz-appearance: none; -ms-appearance: none; -o-appearance: none; appearance: none; } } } </style> <script src="https://code.jquery.com/jquery-1.10.2.js"></script> </head> <body> <select name="sweets" multiple="multiple" class="ListBox"> <option>Chocolate</option> <option selected="selected">Candy</option> <option>Taffy</option> <option selected="selected">Caramel</option> <option>Fudge</option> <option>Cookie</option> </select> <div></div> <script> $( "select" ) .change(function () { var str = ""; $( "select option:selected" ).each(function() { str += $( this ).text() + " "; }); $( "div" ).text( str ); }) .change(); </script> </body> </html> 

Just found this

select::-ms-expand { /* for IE 11 */
    display: none;
}

here:

How to style the <option> with only CSS?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM