0

I've noticed on a lot of sites with custom highlight colors, if you press CTRL + A, the default highlight color, blue, always manages to creep through. Why is that? In making my own site, I have my own custom color too, but I also have the same problem. Does anyone know how to keep this from happening?

http://www.smashingmagazine.com/, http://www.admixweb.com/ are both examples of the CTRL + A problem.

Matt
  • 5,553
  • 5
  • 24
  • 32
  • 2
    In what browser? looks ok to me in FF3.6 and Chrome17. – Andres I Perez Mar 05 '12 at 20:32
  • 1
    Yeah, I'm not having any problems either. If you're talking about other elements with no highlight color set (or whitespace), there's little you can do about that. – Jeffrey Sweeney Mar 05 '12 at 20:35
  • @Andres Ilich, maybe it's time for me to update my browser, which is Chrome, but I haven't downloaded the latest version in a while – Matt Mar 05 '12 at 20:38

2 Answers2

1

Selection styles are mostly browser dependant, and might not be customisable in all browsers. Here is an example of how to configure such styles.

p.normal::selection {
    background:#cc0000;
    color:#fff;
}

p.moz::-moz-selection {
    background:#cc0000;
    color:#fff;
}

p.webkit::-webkit-selection {
    background:#cc0000;
    color:#fff;
}

Such styling are very risky to use and should not be depended upon.

Starx
  • 77,474
  • 47
  • 185
  • 261
0

Smashing Magazine is declaring their CSS selection as follows:

::selection{background:#333; color:#fff}
::-moz-selection{background:#333; color:#fff}

Hitting Cmd + A on my Mac yields the anticipated behavior in Chrome 12.

Nick Beranek
  • 2,721
  • 1
  • 19
  • 14