2

The validator at http://jigsaw.w3.org/css-validator/ says that the value 'text' for 'user-select' is not valid. For a css rule with this code in it:

   user-select: text;
  • the validator says:

    text is not a user-select value : text text

Presumably this is because of this behavior, specified at (the outdated) http://www.w3.org/TR/2000/WD-css3-userint-20000216#user-select:

This property is not inherited, but it does affect children in the same way that display: none does, it limits it. That is if an element is user-select: none, it doesn't matter what the user-select value is of its children, the element's contents or it's childrens contents cannot be selected.

Also, I only see the attribute value 'text' specified in that out-of-date css3 doc from w3.org:

http://www.w3.org/TR/2000/WD-css3-userint-20000216#user-select

and not in the latest one: http://www.w3.org/TR/css3-ui/

Additionally, searching 'whatwg.org' yields nothing.

Any ideas if 'user-select: text' is valid css3, and if not, what should be used instead?

This would be used, for example, when overriding 'user-select: none' rules applied to containers of text and ancestor containers.

christopherbalz
  • 722
  • 1
  • 8
  • 22

1 Answers1

1

You are getting this wrong. user-select:text doesn't mean it would select text only. It's default value of user-select property. W3C describe it this way:

The element's contents follow a standard text content selection model.

And Also MDN syas something same:

-moz-none The text of the element and sub-elements cannot be selected, but selection can be enabled on sub-elements using -moz-user-select:text .

So I don't think this should prevent selecting images or boxes. As far as I know user-select:text is useful when you have user-select:none for most or all of your elements and you have a textbox or text area that is kind of output and you want it be selectable for copying and pasting.

It seems if you use -webkit- prefix it works for me. I'm sure it works with -moz- prefix too. Test this fiddle in your browser. I don't know why user-select:text is not working on my Chrome 13 Mac?

Mohsen
  • 64,437
  • 34
  • 159
  • 186
  • "I don't know why `user-select:text` is not working on my Chrome 13 Mac?" Because nobody supports the "official" way yet? – BoltClock Sep 09 '11 at 01:40
  • Yeah, you're logical. I can remember it was same for border-radius – Mohsen Sep 09 '11 at 02:03
  • "It seems if you use -webkit- prefix it works . . . " - Verified: http://jsfiddle.net/christopherbalz/3zXTC/ That link also verifies that, at this time, plain 'user-select' does either not work or work the same. – christopherbalz Nov 14 '11 at 23:54
  • The css validator may be complaining because 'text' is the default value and the verbiage in the spec, quoted in my question, that says that 'none' can't meaningfully be overridden. But clearly from the fiddles, the proprietary extension can override 'none'. In other words, it does not affect children in the same way that 'display: none' does. – christopherbalz Nov 15 '11 at 00:01