Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other Highlight Color

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #35056
    mwdewitt
    Member

    Okay, go here and highlight anything with your mouse and it turns hot pink with white text. How do I apply this to my own website? I tried using Mozilla Firebug to see what they had in their CSS, but this might just be something simple in HTML. I do not know. I like the effect though. It is a small, personal touch. Help would be greatly appreciated. Thank you!

    #90227
    chrisburton
    Participant

    @mwdewitt

    ::selection {background: pink; color: white;}
    ::-moz-selection {background: pink; color: white;}
    #90229
    mwdewitt
    Member

    It works! Yay! May I ask what the two colons do? I did not include them at first because I thought it was a mistake on your part, but then I added them and everything worked fine. I have never come across two colons in CSS before. Of course, I was never formerly taught how to code either. Thank you once again!

    #90235
    jamygolden
    Member

    I’m not 100% sure what the two with the selection means, but in general two refer two a pesudo element and the one refers to a pseudo selector

    div::before {}
    li:nth-child(2n) {}

    IE8 doesn’t support the two colons for pseudo selector (even though it’s the ‘correct’ way to do it as far as I’m aware) and all modern browsers support the one colon for pseudo elements too. So one has ended up being used for cross browser compatibility.

    #90236
    chrisburton
    Participant

    I also took a look at the spec. It seems as ::selection was dropped.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘Other’ is closed to new topics and replies.