Home > Web Front-end > HTML Tutorial > CSS3改变页面默认选中背景颜色及设置页面禁止全选或局部选择_html/css_WEB-ITnose

CSS3改变页面默认选中背景颜色及设置页面禁止全选或局部选择_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:34:49
Original
1426 people have browsed it

改变默认选中的背景颜色 

::-moz-selection{background:#FF0000;color:#FFFFFF;}::selection {background:#FF0000;color:#FFFFFF;}code::-moz-selection {background:#FF0000;color:#FFFFFF;}code::selection {background:#FF0000;color:#FFFFFF;}
Copy after login

设置页面禁止选中  

/*全局*/html,body{ padding:0px; margin:0px; background:#fff;  moz-user-select: -moz-none; -moz-user-select: none; -o-user-select:none; -khtml-user-select:none; /* you could also put this in a class */ -webkit-user-select:none;/* and add the CSS class here instead */ -ms-user-select:none; user-select:none;/**禁止选中文字*/ }
Copy after login

以上代码属于css3所以IE9以下的浏览器可能会出现不兼容的现象。  

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template