0

~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>
aynber
  • 22,380
  • 8
  • 50
  • 63
Sandeep
  • 320
  • 2
  • 4
  • 18

1 Answers1

0

Just found this

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

here:

How to style the <option> with only CSS?

Community
  • 1
  • 1
Carol McKay
  • 2,438
  • 1
  • 15
  • 15
  • – Sandeep Jul 10 '16 at 07:24
  • :) may be... but I have to make it look pretty. Please help. – Sandeep Jul 10 '16 at 07:44