css change highlight color code example

Example 1: hcss change highlight color

::selection {
  background: #ffb7b7; /* WebKit/Blink Browsers */
}
::-moz-selection {
  background: #ffb7b7; /* Gecko Browsers */
}

Example 2: custom selection color css

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

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

Example 3: change highlight color html

::-moz-selection { /* Code for Firefox */
  color: red;
  background: yellow;
}

::selection {
  color: red;
  background: yellow;
}

Example 4: css selected color

::selection {
    background-color: #222;
    color: white;
}