Selection Styles

With the creation of CSS3 it’s now possible to define the color and background of selected text. It first caught my attention when browsing moo.fx’s website. QuirksMode had a short article on it as well.

While it has no real practical use, it can certainly add to the ascetic appeal of a website when properly utilized. Simply add the “::[-moz-]selection” Psuedo Element to your stylesheet and define the color and background values to whatever you like.

::selection {
    color: #666666;
    background: #CCCCCC;
}

::-moz-selection {
    color: #666666;
    background: #CCCCCC;
}

You can check out the W3 Specifications for more information on this interesting new addition to CSS.

Advertisements

Leave a Reply

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


%d bloggers like this: