CSS3 Tutorial: How To Change Default Text Selection Colour

Whilst this CSS3 declaration might not be crucial to your project or design and yes it is not supported by all browsers, but it is a fantastic effect that really takes your design one step further.
Currently FireFox, Safari, Chrome and Opera support the text section attribute, and the browsers that don’t support it simply ignore the code so nothing will break, so it doesn’t really matter.
We have setup a demo which you can test out further down the page; we have used the DesignJuices colours in the example.
The basic snippet to achieve this is:
::selection {
background:#f094b7;
color:#555;
}::-moz-selection {
background:#f094b7;
color:#555;
}::-webkit-selection {
background:#f094b7;
color:#555;
}
Now if you were aiming for one colour for every text item whilst highlighted that is enough for you, but there may be circumstance you need to have different coloured highlights for different sections of your page.
We can have more than one instance of this by using classes, for example:
p.orange::selection {
background:#c2660d;
color:#fff;
}p.orange::-moz-selection {
background:#c2660d;
color:#fff;
}p.orange::-webkit-selection {
background:#c2660d;
color:#fff;
}p.blue::selection {
background:#2d7e99;
color:#fff;
}p.blue::-moz-selection {
background:#2d7e99;
color:#fff;
}p.blue::-webkit-selection {
background:#2d7e99;
color:#fff;
}
Take a look at the demo to see the effect in all its glory, please note you will have to view using a compatible browser as mentioned above.
Please leave any comments and experiences of this tutorial below.
Take advantage of cheap printing services of PsPrint
Pass your asp net MB2-421 in initial tries by using our latest and high quality 70-526 and free 70-648 tutorials.



Pingback: designfloat.com
Pingback: zabox.net
Pingback: pligg.com
Pingback: joyoge.com
Pingback: How to Change Default Text Selection Color | six03
Pingback: Collective: CSS3 Tutorial: How To Change Default Text Selection Colour | Codrops
Pingback: CSS3 Tutorial: How To Change Default Text Selection Colour | Design Newz
Pingback: CSS3 Tutorial: How To Change Default Text Selection Colour | The best Tutorials
Pingback: Collective: CSS3 Tutorial: How To Change Default Text Selection Colour « Theory Code
Pingback: CSS Brigit | CSS3 Tutorial: How To Change Default Text Selection Colour
Pingback: Collective: CSS3 Tutorial: How To Change Default Text Selection Colour
Pingback: CSS3 Tutorial: How To Change Default Text Selection Colour : Speckyboy Design Magazine
Pingback: 160+ Articles: The Best Roundup of Creativity on the Web September | nenuno creative
Pingback: Cambiar el color de la selección utilizando CSS3 | Kabytes
Pingback: 110+ Tutorial & Resources For Web Designer And Web Developer | blogfreakz.com
Pingback: CSS3: Resources, Tutorials and DemosFreelance Review | Freelance Review
Pingback: CSS3: Resources, Tutorials and Demos | gabriel catalano | in-perfección
Pingback: September’s Best Resources for CSS3
Pingback: 52 Essential Tutorials, Resources For Learning CSS3 | Tutslist - Graphic, Web design and Web development tutorials
Pingback: CSS3 Tutorials to Brighten Up Your Day - Noupe Design Blog
Pingback: Everything is as your ways : Awesome CSS/Javascript technique
Pingback: 30 Useful and Cutting Edge CSS3 Text Effect and Web Typography Tutorials
Pingback: CSS3 tutorials, 150+ exercises for web developers
Pingback: 150+ CSS3 tutorials and exercises for web developers - DesignShock
Pingback: 109 interesantes tutoriales y recursos CSS3 | Digisolnet Blog
Pingback: 23 Creative Uses of CSS3 Text Effects to Enhance Your Web Presence | Bitmag
Pingback: 15 Amazing CSS3 Text Effects
Pingback: 15 text effect achieved with CSS3 - Open News
Pingback: E-sitesweb » 30 Useful and Cutting Edge CSS3 Text Effect and Web Typography Tutorials
Pingback: CSS3 Tutorials « CSS Tips
Pingback: 52 Essential Tutorials, Resources For Learning CSS3 | TutsList
Pingback: Learn how-to Create CSS3 Text Effects - 30 Mystic CSS3 Tutorials | Dzinepress