970_90

Tuesday, 26 July 2016

Overriding The Default Text Selection Color With CSS

Overriding The Default Text Selection Color With CSS

Question: Write CSS for change the default Text Selection to red.?
::selection {
  background: red; /* Blink/WebKit Browsers */
}
::-moz-selection {
  background: red; /* Gecko Browsers */
}



Question: Change the default Text Selection to BLUE for paragraph (p.webtechnology)?
p.webtechnology::selection {
  background: blue; /* Blink/WebKit Browsers */
}
p.webtechnology::-moz-selection {
  background: blue; /* Gecko Browsers */
}

See Demo Below

Blue Color On Selection




Question: Change the default Text Selection to RED for paragraph (p.redcolor)?
p.redcolor::selection {
  background: red; /* Blink/WebKit Browsers */
}
p.redcolor::-moz-selection {
  background: red; /* Gecko Browsers */
}

See Demo Below

Red Color Selection




No comments:

Post a Comment