Deprecated: imwpcache\f884414bce24ee67f\f73723ec7b1919fa5::__construct(): Implicitly marking parameter $YECBGYFECGEAFWHA as nullable is deprecated, the explicit nullable type must be used instead in /www/wwwroot/www.chuangxiangniao.com/wp-content/plugins/imwpcache-dist/build/f884414bce24ee67ff73723ec7b1919fa5.php on line 2

Deprecated: imwpcache\f884414bce24ee67f\f73723ec7b1919fa5::__construct(): Implicitly marking parameter $BBWFDDBHHYHDXXAB as nullable is deprecated, the explicit nullable type must be used instead in /www/wwwroot/www.chuangxiangniao.com/wp-content/plugins/imwpcache-dist/build/f884414bce24ee67ff73723ec7b1919fa5.php on line 2
css怎样不让复制页面内容_创想鸟

css怎样不让复制页面内容

在css中,可以利用“user-select”属性实现不能复制页面内容效果,该属性用于规定是否能够选取元素的内容,当属性的值为“none”时,元素的内容就不会被选取,进而不会被复制,语法为“元素{user-select:none;}”。

css怎样不让复制页面内容

本教程操作环境:windows10系统、CSS3&&HTML5版、Dell G3电脑。

css怎样不让复制页面内容

在css中,想要实现不能复制页面内容效果,可以利用user-select属性。

user-select属性规定是否能选取元素的文本。在 web 浏览器中,如果您在文本上双击,文本会被选取或高亮显示。此属性用于阻止这种行为。

立即学习“前端免费学习笔记(深入)”;

语法如下:

user-select: auto|none|text|all;

其中属性值代表的含义如下:

01.png

其中需要注意的是:

   -moz-user-select:none; /* Firefox私有属性 */    -webkit-user-select:none; /* WebKit内核私有属性 */    -ms-user-select:none; /* IE私有属性(IE10及以后) */    -khtml-user-select:none; /* KHTML内核私有属性 */    -o-user-select:none; /* Opera私有属性 */    user-select:none; /* CSS3属性 */

示例如下:

 body{  -webkit-user-select: none; /* Safari */  -ms-user-select: none; /* IE 10 and IE 11 */  user-select: none; /* Standard syntax */}

user-select 属性

给页面body元素添加user-select属性,就可以让页面内容禁止复制了。

输出结果:

02.png

上述示例中输出的文本已经不能复制了。

(学习视频分享:css视频教程)

以上就是css怎样不让复制页面内容的详细内容,更多请关注创想鸟其它相关文章!

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/1623134.html

赞 (0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
css怎样去掉li元素默认样式
上一篇 2025年12月24日 08:11:06
css怎样将无序列表前的点去掉
下一篇 2025年12月24日 08:11:16

相关推荐

发表回复

登录后才能评论
关注微信