Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

CSS3 ::selection alternative?

Options
  • 10-10-2014 4:58pm
    #1
    Registered Users Posts: 4,468 ✭✭✭


    Hi all,

    I'm a few weeks into my final semester in the h.dip i'm doing and we've finally been introduced to html and css!

    One question is asking me to change the text selection colour.

    I have tried to use both ::-moz-selection and ::selection, but these fail to validate in the w3 schools css validator.
    For submission, this must absolutely validate green, so i am asking, have you guys got any method by which i can alter the text selection color within the current CSS3 standards list?

    Cheers for any and all help.

    I do appologise for asking for help with homework, but an hour+ of google leaves me with nothing but the ::selection method....


Comments

  • Registered Users Posts: 586 ✭✭✭Aswerty


    Yeah doesn't really look to be anything else out there and ::selection was only an experimental psuedo-element. So I'm not much help to you!

    I'd hope nobody has an issue answering the question because it's homework since it is a straight up knowledge question.


  • Registered Users Posts: 4,468 ✭✭✭CruelCoin


    Aswerty wrote: »
    I'd hope nobody has an issue answering the question because it's homework since it is a straight up knowledge question.

    Well i hope so.

    The program works, and fullfills all the criteria for the assignment.

    Just doesn't pass the validator... :-(


  • Registered Users Posts: 6,207 ✭✭✭miralize


    Sounds like a trick question from your lecturer! Are you allowed to use a JS solution/polyfill?


  • Registered Users Posts: 4,468 ✭✭✭CruelCoin


    miralize wrote: »
    Sounds like a trick question from your lecturer! Are you allowed to use a JS solution/polyfill?

    We're covering JS next week, so i think this could be a trick question.


  • Registered Users Posts: 6,207 ✭✭✭miralize


    You'd probably get extra credit for understanding the issue & recognizing that there is no validatable solution. I'd add that in somewhere in your assignment upload.


  • Advertisement
  • Closed Accounts Posts: 9,046 ✭✭✭Berserker


    CruelCoin wrote: »
    We're covering JS next week, so i think this could be a trick question.

    As someone who has experience tutoring students from this course, I can tell you that it is a trick question. On introducing JS to you next week, he/she will mention this question and ask people how they solved it. Then he/she will present JS and it's role in solving that problem.

    Top marks for recognizing this. Students usually get bonus marks for this. The lecturer I worked with gave an extra 5%, so a student could potentially get 105%. As others have said, ::selection won't validate. The JS solution is pretty straight forward.


  • Registered Users Posts: 6,150 ✭✭✭Talisman


    Mozilla Developer Network has an explanation:
    Though this pseudo-element was in drafts of CSS Selectors Level 3, it was removed during the Candidate Recommendation phase, as it appeared that its behavior was under-specified, especially with nested elements, and interoperability wasn't achieved.

    Because they aren't part of the CSS spec the W3C validator will fail them. But this does not mean your web page is broken in any way - think of it as Mozilla Firefox offering additional CSS features, so users of that browser get a richer experience without the need for additional JavaScript.


  • Registered Users Posts: 4,468 ✭✭✭CruelCoin


    Cheers for the advidce lads


Advertisement