Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Disable Keyboard Key with CSS?

Tags:

css

Can we disable keyboard key (Ctrl+A/Ctrl+C) with CSS, so that nobody can use select all shortcut using keyboard in my website?

like image 290
Ovee Avatar asked Dec 28 '12 16:12

Ovee


People also ask

How do I disable the keyboard on my website?

To lock your keyboard, press Ctrl+Alt+L. The Keyboard Locker icon changes to indicate that the keyboard is locked. Almost all keyboard input is now disabled, including function keys, Caps Lock, Num Lock, and most special keys on media keyboards.


2 Answers

No, CSS cannot affect the browser's response to the keyboard. JavaScript can, but JavaScript can also be turned off.

In other words: you can't do that, and even if you do then you can't count on it.

like image 106
Jon Avatar answered Sep 24 '22 00:09

Jon


Not with CSS, however it's possible using JavaScript if the browser doesn't have the feature disabled.

like image 35
scragar Avatar answered Sep 24 '22 00:09

scragar