html设置文字无法选中的方法:1、创建HTML页面文件;2、通过设置css样式为“user-seletct: none;-webkit-user-seletct: none;-moz-user-seletct: none;”即可。

本文操作环境:windows7系统、HTML5版、DELL G3电脑
html 怎么设置文字无法选中?
控制HTML页面内容不能选中的方法
方法有二
立即学习“前端免费学习笔记(深入)”;
一: css 方法
user-seletct: none; -webkit-user-seletct: none; -moz-user-seletct: none; -ms-user-seletct: none;
none: 不能选中内容
text: 能选中内容
二:js 方法
document.body.onselectstart = function(){
return false;
}返回 false,不能选中
返回 true,能选中
推荐学习:《HTML5视频教程》
以上就是html 怎么设置文字无法选中的详细内容,更多请关注php中文网其它相关文章!
HTML怎么学习?HTML怎么入门?HTML在哪学?HTML怎么学才快?不用担心,这里为大家提供了HTML速学教程(入门课程),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号