Export (0) Print
Expand All

Specifying selectable text

The -ms-user-select property is a new Cascading Style Sheets (CSS) property that enables app and web developers to control where users are able to select text within their Windows Store apps using JavaScript or webpages. The user-select property is not currently part of any World Wide Web Consortium (W3C) CSS specification. It was originally proposed in the User Interface for CSS3 module, but this module has since been superseded by CSS3 Basic User Interface Module, which does not contain the user-select property. Other major browsers support their own prefixed versions of this property. There are minor differences between the three implementations, so be sure to test your application across browsers.

The -ms-user-select property's syntax

The -ms-user-select accepts the following three keywords.

KeywordDescription

none

Blocks selection from starting on that element. It will not block an existing selection from entering the element.

element

Enables selection to start within the element; however, the selection is contained by the bounds of that element.

text

Enables selection to start within the element and extend past the element's bounds.

 

API Reference

-ms-user-select

Samples and tutorials

CSS User selection sample
How to prevent (or enable) text selection on your webpage using CSS

Internet Explorer Test Drive demos

User-Select

IEBlog posts

Controlling Selection with CSS user-select

Specification

User Interface for CSS3 (now superceded by CSS Basic User Interface Module Level 3)

 

 

Show:
© 2014 Microsoft