If I have a list of optons, how can I use the CSS pseudo-element :before{ content: '' } to affect the <option>
? Below there are three options an I'd like to insert text before each one.
I know this can be done wit javascript / jQuery, but is it possible with CSS?
<html>
<head>
<style>
option::before {
content: "sandy - "
}
</style>
</head>
<body>
<select>
<option>beach</option>
<option>field</option>
<option>carpet</option>
</select>
</body>
</html>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…