将以下代码添加至PHP
或者HTML
代码中即可,如果需要添加至style.css
中,需去掉<style></style>
- 禁止文字选中
<style>
body{ /*禁止文字选中*/
-moz-user-select:none;/*火狐*/
-webkit-user-select:none;/*webkit浏览器*/
-ms-user-select:none;/*IE10*/
-khtml-user-select:none;/*早期浏览器*/
user-select:none;
}
</style>
- 背景自适应
<style>
body{margin:0 auto}
@media screen and (min-width: 768px) { /*浏览器大于768px时使用的背景*/
body {background:url(http://cdn.mgxfd.club/gamebackground.jpg);background-position-x:center;}
}
@media screen and (max-width: 767px) { /*浏览器小于767px时使用的背景*/
body {background:url(http://cdn.mgxfd.club/n_gamebackground.jpg);background-position-x:center;}
}
</style>