禁止各浏览器标签的选中功能
有时候为了让网页中的文字不能被选中,需要将选中功能禁止掉。
关键代码:
/* 禁止各浏览器标签的选中功能 */ moz-user-select: -moz-none; -moz-user-select: none; -o-user-select:none; -khtml-user-select:none; -webkit-user-select:none; -ms-user-select:none; user-select:none;
下面是一个实例:
<!DOCTYPE html> <html> <head> <title>禁止选中功能</title> <meta charset="utf-8"> <style type="text/css"> * { /* 禁止各浏览器标签的选中功能 */ moz-user-select: -moz-none; -moz-user-select: none; -o-user-select:none; -khtml-user-select:none; -webkit-user-select:none; -ms-user-select:none; user-select:none; } </style> </head> <body> <p>看看还能不能用鼠标选中这段文字</p> </body> </html>