Printable Version of Topic

Click here to view this topic in its original format

HTMLHelp Forums _ Cascading Style Sheets _ user-select: unset | none

Posted by: Dag Dec 19 2019, 05:44 AM

The genious webmaster decided that I should not copy his content, which is in public anyway, so (s)he wrote in his default.css:

CODE

* {
    user-select: none !important;
    -moz-user-select: none !important;
    -webkit-user-select: none !important;
    -ms-user-select: none !important;
    }


!important everywhere of course... So, I wrote in my css for customization (I should use one line only but never mind):
CODE

* {
    user-select: unset !important;
    -moz-user-select: all !important;
    -webkit-user-select: all !important;
    -ms-user-select: element !important;
    }

and my !important is more important than his !important.

I need to keep in one of his sections "user-select: none" but now it is not possible. My first !important is more important than mine second !important smile.gif) Is there any way to solve this issue? Override or something...

Thanks in advance.

Posted by: Christian J Dec 19 2019, 07:12 AM

Can't you add another style block:

CODE

* {
    user-select: all !important;
    -moz-user-select: all !important;
    -webkit-user-select: all !important;
    -ms-user-select: element !important;
    }

section {
    user-select: none !important;
    -moz-user-select: none !important;
    -webkit-user-select: none !important;
    -ms-user-select: none !important;
}

?

(I don't think "unset" is a valid value.)

Posted by: Dag Dec 19 2019, 09:50 AM

Unset I copied from somewhere... DUnno does it works... I am uzing-mozillass

I did exactly that what you wrote but without effect...

Maybe there sre some exclussions in the first directive? Something as:
* (but not/exclude section id 3) {...}

QUOTE(Christian J @ Dec 19 2019, 04:12 PM) *

Can't you add another style block:

CODE

* {
    user-select: all !important;
    -moz-user-select: all !important;
    -webkit-user-select: all !important;
    -ms-user-select: element !important;
    }

section {
    user-select: none !important;
    -moz-user-select: none !important;
    -webkit-user-select: none !important;
    -ms-user-select: none !important;
}

?

(I don't think "unset" is a valid value.)


Posted by: Dag Dec 19 2019, 09:54 AM

Idea...

Maybe to turn the order? First section and then * ?
Or to try inherit?

Posted by: Christian J Dec 19 2019, 10:31 AM

QUOTE(Dag @ Dec 19 2019, 03:50 PM) *

I did exactly that what you wrote but without effect...

I didn't test with a User stylesheet, maybe you must restart the browser after every change to the CSS file?

QUOTE
Maybe there sre some exclussions in the first directive? Something as:
* (but not/exclude section id 3) {...}

This works on my test page:

CODE
:not(section) {
    user-select: all !important;
    -moz-user-select: all !important;
    -webkit-user-select: all !important;
    -ms-user-select: element !important;
    }

https://developer.mozilla.org/en-US/docs/Web/CSS/:not

Posted by: Dag Dec 20 2019, 01:51 AM

QUOTE(Christian J @ Dec 19 2019, 07:31 PM) *

I didn't test with a User stylesheet, maybe you must restart the browser after every change to the CSS file?

Restart is obligatory always. But you can't override '* all'. And I think not because of !important 1 rule versus !important 2 rule (rule 1 can't be overwritten) but because of absent section in * directive. You can't override apples with pears. If I wrote
CODE
section_x {
    user-select: all !important;
    }

and then
CODE
section_x {
    user-select: none !important;
    }

it should work! But I had no choice. To override their directive, I have to use the same their element (for the start point)!

QUOTE(Christian J @ Dec 19 2019, 07:31 PM) *

This works on my test page:
CODE
:not(section) {
    user-select: all !important;
    -moz-user-select: all !important;
    -webkit-user-select: all !important;
    -ms-user-select: element !important;
    }

https://developer.mozilla.org/en-US/docs/Web/CSS/:not

Yes yes... I remember that ':not'... This must work. I'll try and than write (and thanks) again.

Posted by: Christian J Dec 20 2019, 07:30 AM

QUOTE(Dag @ Dec 20 2019, 07:51 AM) *

But you can't override '* all'.

Yes you can:

CODE
* {color: red;}
p {color: blue;}

But see also https://www.w3.org/TR/2011/REC-CSS2-20110607/selector.html#universal-selector

QUOTE
*[lang=fr] and [lang=fr] are equivalent.
*.warning and .warning are equivalent.
*#myid and #myid are equivalent.



Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)