CSS 3 Module <== Test # ==>
W3C Selectors 14 of 15 of the interactive tests category
Testing Date Revision
:focus with ::selection (ID #164) 21-november-2001 1.0

NOTE: User interaction is required for this test.

  textarea { border: solid thick gray; }
  textarea:focus { border: solid thick green; }
  textarea::selection { background: silver; color: black; }
  textarea:focus::selection { background: lime; color: black; }
   <p><textarea rows="5" cols="70">Select some of this text, then change the focus around. While this
text is focussed, the selection should be green. While the focus is
elsewhere, the selection should be silver. The border should at all
times be a darker colour than the selection&#39;s background. Repeat the
test with everything selected.</textarea></p>