CSS trick to change the color of selected text on any web page


The easiest way to change the color of selected text on any web page is using pure CSS trick which you might not know. Working on some project , today , i find a trick to change the color of selected text. Whenever a person select a text , its color changes to defined color. For example, on my blog theme ,if you select some text you will notice green color in place of indigo. ( which is default color ). I simply added four lines of CSS and all it happens.

Here is the trick. Simply copy and paste the following CSS into your stylesheet and see the magic.

1
2
3
4
5
6
::-moz-selection{
background:#93B805;color:#fff
}
::selection{
background:#93B805;color:#fff
}

This property is not supported by IE

All done!!
cheers!

Recently Published

»

How to Show Related Posts in WordPress Without a Plugin?

Making your visitors go through each post increases the browsing time ...

»

Noteworthy Facts About Android App Piracy and How It Can Be Dealt With

Are you a gaming aficionado, and obsessed with gaming apps? Do you ...

»

4 Great Ways to Turn Your Images into SEO Tools

Photos on a website help us to understand the website much more ...

»

8 Search Form Tutorials Built With CSS3, jQuery & HTML5

Elevate the power of search by adding search functionality or search ...

»

10 Best HTML5 Frameworks For Hybrid App Development

Hybrid apps are generally built around native web view container or ...

»

A Look at The Evolution Of WordPress and What Future Holds For It

When it comes to developing a website, WordPress is the first name ...

»

7 WordPress Plugins That Make Your Site Mobile Responsive

Not much in the recent past, having a responsive website that works ...

»

Things you should Consider When You Are Designing an E-commerce Website

The people of today’s generation have discovered the various ...

»

Developing a Mobile App Using Open Source Software? Consider These Tips For Security

Today, almost every IT organization (including the Fortune 500 ...