html css select color code example

Example 1: custom selection color css

::selection {
	color: #000000;
	background-color: red;
}

/* for firefox */
::moz-selection {
	color: #000000;
	background-color: red;
}

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>

Tags:

Html Example