How to change background color of selected text

I was willing to see how some of websites have beautiful colors when we select text on the pages. Just searching for the trick and got that its a simple CSS property to override default behaviour of browsers. You have to just apply background color and its done, more over if you want to change the text color also you can apply color in CSS. This simple CSS class will do it all for you.


::-moz-selection{
background:#66b0e6;
}
::selection{
background:#66b0e6;
}

Fiddle : (select the text below) http://jsfiddle.net/pearls/xQQyh/3/embedded/result,js,html,css/

Advertisements

Say something : I accept all the "Humer&Critic"

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s