Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8092437
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:16:59+00:00 2026-06-05T20:16:59+00:00

Issue Using the following just simply doesn’t work properly in -webkit- and -moz- browsers:

  • 0

Issue

Using the following just simply doesn’t work properly in -webkit- and -moz- browsers:

#exampleElement {
    background-color: red; /* For example */
}

#exampleElement ::selection {
    color: black;
    background-color: white;
}

 

Result: WebKit- and Blink-powered browsers

In Chrome, Opera, and Safari, ::selection‘s background-color renders as if it was 50% alpha but the font colour is correct.

Chrome 29.0.1547.62:
Chrome 29.0.1547.62

Opera 15.0.1147.130:
Opera 15.0.1147.130

Safari 5.34.57.2:
Safari 5.34.57.2

 

Result: Gecko-powered browsers

In Firefox, the entire ::selection rule is ignored. ::selection‘s background-color just happens to be white due to #exampleElement‘s dark background-color (thanks to @BoltClock for noticing that)

Firefox 22.0:
Firefox 22.0

 

Result: Trident-powered browsers

In Internet Explorer, (would you believe) everything is rendered perfectly.

Internet Explorer 10.0.9200.16660:
Internet Explorer 10.0.9200.16660

 

Is this just a flaw of these rendering engines / browsers or are there -webkit- and -moz- alternatives that I’m unaware of?

I’ve saved an example of this on jsFiddle, for people to see: http://jsfiddle.net/BWGJ2/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T20:17:00+00:00Added an answer on June 5, 2026 at 8:17 pm

    According to quirksmode.org, -webkit-selection and -moz-selection are indeed available. I just tested it with Chrome (18) and Firefox (13) and can confirm that it works with Firefox, but I didn’t have success with -webkit-selection on Chrome (it ignored it), and according to this SO question it doesn’t exist (and the answer says that ::selection should also work on all browser, but doesn’t for me, too).

    As already metioned in this answer, Chrome forces the selection to be transparent, but you can work around this using

    background:rgba(255, 255, 255, 0.99);
    

    For more details, checkout the linked answer by tw16


    Furthermore, this works for me on FF:

    ::selection { /* stuff */ }
    ::-moz-selection { /* stuff */}
    

    But this does not:

    ::selection, ::-moz-selection { /* stuff */ }
    

    But maybe this is not related to ::selection but does apply on all pseudo elements, couldn’t find an answer to that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I believe I am having a memory issue using numpy arrays. The following code
I faced the following issue while I submitting my form using jQuery FORM and
I am using Django 1.3 and have the following issue: In the Admin list
In following code the issue is, that I cannot test dao.add() without using dao.list().size()
Colleagues, Using JPA I need resolve following issue: at database level exits 3 entities
EDIT: I am basically running into the following documented issue . I am using
I'm having an interesting issue with gcc 4.5.2. The following code #include<thread> #include<iostream> using
The following is some background info on this post. You can just skip to
I have an issue using Ajax upload with Spring 3 MVC. I understand that
I am having a issue using Google's SDC (Secure Data Connector) with my Google

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.