怎么实现html禁止选择


本文摘自PHP中文网,作者藏色散人,侵删。

html禁止选择的实现方法:1、通过css的方式实现禁止html内容被选中;2、通过在body标签中添加onselectstart等属性实现禁止html内容被选中;3、通过在js中添加onselectstart语句实现禁止。

本文操作环境:windows7系统、HTML5&&CSS3版、Dell G3电脑。

页面中,禁止html内容被选中

1、通过css的方式

1

2

3

4

5

6

7

8

9

*{

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;

}

user-select属性:参考https://www.html.cn/book/css/properties/user-interface/user-select.htm

阅读剩余部分

相关阅读 >>

关于Html、js的一些用法小技巧

Html怎么去掉空格

Html 本地存储

Html如何给文本文字添加删除线?两种方法添加删除线(实例)

Html5 canvas实现中奖转盘的实例代码

jsp与Html之间有什么区别

canvas 学习 3---画坐标系

Html怎么学

Html怎么让元素隐藏

Html header标签怎么用

更多相关阅读请进入《Html》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...