How to control the color of selected text

Source: Internet
Author: User

We all know that the default background color is blue after the page text is selected on the browser. For designers who like to pursue their own personality, the same color seems too hard to pursue, the following describes how to customize the color of the selected text in the browser to fully display the personalized design! In fact, it is mainly implemented using some small features of CSS3. There is nothing special about it. See the following sample code.

(1) Change the selected text style of the entire page as follows:

::selection {    background:#ff0033;    color:#555;}::-moz-selection {    background:#ff0033;    color:#555;}::-webkit-selection {    background:#ff0033;    color:#555;}

The preceding settings change the background color of the selected text to red.

(2) set the style status after the selected content and text of the specified content block on the page. For example:

.ac_content::selection {    background:#000;    color:#fff;}.ac_content::-moz-selection {    background:#000;    color:#fff;}.ac_content::-webkit-selection {    background:#000;    color:#fff;}

The above settings will change the selected text in the ac_content block of the class in the page to black and white.

Articles you may be interested in
  • Css controls code for force-breaking and non-wrapping in English and Chinese
  • Windows cannot start the hardware device because its configuration information (in the Registry) is incomplete or damaged. (Code 19) Solution
  • Key search engine technologies: Introduction to Chinese Word Segmentation
  • Prohibit web page right-click, copy, save as, View Source file and other functions to implement web page source code protection
  • Jquery drop-down menu (ultra-simple and practical, compatible with mainstream browsers such as IE and firefox)
  • Php obtains the start and end timestamps of today, yesterday, last week, and this month.
  • Php clears (deletes) the files in the specified directory, and does not delete the directory folder.
  • Conversion of date and unix timestamps in php and mysql

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.