css selected a code example
Example 1: css on click
<!DOCTYPE html>
<html>
<head>
<style>
a:active {
background-color: yellow;
}
button:focus {
background-color: yellow;
}
h1:hover {
background-color: red;
}
p:hover {
background-color: red;
}
</style>
</head>
<body>
<a href="#">Click Me</a>
<button>Click me</button>
<h1>Hover over me</h1>
<p>Hover over me</p>
</body>
</html>
Example 2: how to add a selection in css
<div class="custom-select-wrapper">
<div class="custom-select">
<div class="custom-select__trigger"><span>Tesla</span>
<div class="arrow"></div>
</div>
<div class="custom-options">
<span class="custom-option selected" data-value="tesla">Tesla</span>
<span class="custom-option" data-value="volvo">Volvo</span>
<span class="custom-option" data-value="mercedes">Mercedes</span>
</div>
</div>
</div>