How can I change the selection text background using CSS?


Tags: html,css

Problem :

Can anyone tell me how to change the selection text background using CSS?

Most new websites show a custom background color rather than the default blue?



Solution :

here is a tutorial for that : http://css-tricks.com/overriding-the-default-text-selection-color-with-css/

::selection {
    background: #ffb7b7; /* Safari */
    }
::-moz-selection {
    background: #ffb7b7; /* Firefox */
}

    CSS Howto..

    How should I organize the contents of my CSS file(s)?

    How to keep divs position fixed even after deleting its neighbors?

    How can I dock the button to jQueryUI dialog bottom as the dialog inner content increases?

    How to make a border in css that is actually on the very edges

    How to change the cursor icon when dragging in HTML5?

    How to change the content value of iconmoon font?

    How to override inline CSS (specifically a div with certain class) with external CSS?

    How to align the bottom of two left- and right aligned texts with bottom of parent container?

    How can I achieve this Flash effect using jQuery?

    How to make a caret in a link change color when the LINK is hovered over?

    How to position nav element center under parent div?

    How to replace non-existing images with a default one in css?

    How to remove all inherited CSS formatting for a table?

    How do I convert scss to css

    How to avoid IE11 “slow” evaluation of CSS :invalid and :valid pseudo selectors

    Html, CSS - How to create a donut chart like this?

    How do I implement a MailChimp API form embed?

    How do I create a fallback for the HTML5 search cancel button in webkit?

    How to show only a portion of an image just by using the img tag?

    How can I change the color CSS property of an element using jQuery

    What to do to align text as shown in the image using HTML and CSS?

    How to insert css code in php?

    How do I remove the padding between the content of the cell and the cell borders in a table? [duplicate]

    How do I use CSS with simple form?

    How to create a 3 columns fluid fixed fluid layout?

    How to do a “true” carbon fiber CSS background

    How to control element position when changing window size for parallax purpose

    How to create two CSS transitions in parallel on nested elements

    Wordpress nav menu images not showing up in mobile safari

    How to avoid the pain of CSS multi-browser compatibility?