html - Styling selected option -
this question has answer here:
pretty self explaining, need style option selected user. possible without javascript?
simple example:
html:
<select multiple> <option class="opt1" value="">option 1</option> <option class="opt2" value="">option 2</option> </select>
css:
.opt1[selected]{ background-color: red; } .opt2{ background-color: green; }
try .
<style> .your-select option:checked {background:#333;padding:20px;width:100px;border:3px solid #f00} </style> <select multiple class="your-select"> <option class="opt1" value="">option 1</option> <option class="opt2" value="">option 2</option> </select>
Comments
Post a Comment