Disabling Text Selection Not Working
-
<div> <style type = "text/css"> #noselect{ -webkit-user-select: none; -moz-user-select: none; -khtml-user-select: none; -webkit-touch-callout: none; -ms-user-select: none; user-select: none; } </style> <p class="has-normal-font-size" id = "noselect">My Text Here!!!</p> </div>I created a custom HTML block and wrote this code in it, to make my text not selectable. It seems to work fine, when I preview that block alone. But when I preview the whole page, I can freely select the text. This isn’t working after updating my page also. Why is that, and what can I do to resolve the problem?
Any help would be appreciated.
The blog I need help with is: (visible only to logged in users)
-
The code you can use on a free wordpress.com account is very limited, https://wordpress.com/support/wordpress-editor/blocks/custom-html-block/.
Also note there is no fullproof system to prevent content theft from your site; you can only make it a bit more difficult, https://wordpress.com/support/prevent-content-theft/. -
Hi there,
It’s not possible to add a
<style>element directly to the content of a post or page. The<style>HTML element only works if it’s added in the<head>section of the page, and you don’t have access to the HTML of the site itself to edit that.The only way to add styling inside the editor itself is to use the
styleattribute inside the actual<p>element inside the post.To add new CSS classes or IDs to your site, you need to add it under Additional CSS in the Customizer, and that option is only available in the Premium Plan and higher.
https://wordpress.com/support/custom-css/
That said, we don’t support the
user-selectproperty on WordPress.com, so the only way to use that here would be on our Business Plan, which is not subject to the code restrictions on WordPress.com.
- The topic ‘Disabling Text Selection Not Working’ is closed to new replies.