Search
 
SCRIPT & CODE EXAMPLE
 

HTML

CSS apply to selected option in select tag

<form id="location-options">
        <select name="location-category" id="location-category">
            <option value="">Select</option>
            <option value="test1">Imbiss</option>
            <option value="test2" selected>Restaurant</option>
            <option value="test1">Imbiss</option>
            <option value="test2">Restaurant</option>
        </select>
    </form>
    <style>
        #location-options select option[selected],
        #location-options select option:hover,
        #location-options select option:focus,
        #location-options select option:active,
        #location-options select option:checked {
            background: red;
            color: white
        }
    </style>
 Run code snippet
Comment

PREVIOUS NEXT
Code Example
Html :: vertical tab bootstrap 
Html :: fixed footer button css 
Html :: placeholder wpf 
Html :: html image with link 
Html :: html table two headers 
Html :: tailwind css float right 
Html :: html button link 
Html :: a link in new window 
Html :: bootstrap 5 input group 
Html :: meta tags in pug 
Html :: html video disable controls 
Html :: Meta Tag Generato - SEO 
Html :: bind script html 
Html :: react native text max rows 
Html :: fav icon 
Html :: vscode format html on save 
Html :: bootstrap 4.5 max-height 
Html :: bootstrap hamburger menu 
Html :: HTML Links - Different Colors 
Html :: change text width html 
Html :: jquery insert html into iframe 
Html :: set file allow html 
Html :: html table title 
Html :: html <br 
Html :: on click in a tag 
Html :: center class in html 
Html :: placeholder text html 
Html :: tag img 
Html :: link to section on page html 
Html :: spaces html 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =