HTML、CSS、JS小点汇总

it2022-05-05  159

不断更新。

HTML

禁用滚动条

<body style="overflow:hidden">

CSS

按钮居中

text-align: center; margin: 0 auto; display: block;

页面不能被选中

.cannotselect { user-select: none; -webkit-touch-callout: none; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; }

背景图片自适应窗口尺寸

法一

background-size:cover;

法二

background: url(bg.jpg) no-repeat; background-size: 100%;

按钮加背景图片

background: url(btnbg.jpg);

JS

按钮灰显/显示

document.getElementById("start").disabled = true;//灰显 document.getElementById("start").disabled = false;//显示

按钮显示/消失

document.getElementById("start").style.display = "none";//消失 document.getElementById("start").style.display = "block";//显示

最新回复(0)