body{ margin: 0; background: url(img/bg.png) no-repeat fixed; background-size: cover; }
或者
html,body{ width: 100%; height: 100%; } body{ margin: 0; background: url(img/bg.png) no-repeat; background-size: cover; }
body{ margin: 0; background: url(img/bg.png) no-repeat fixed; background-size: cover; }
或者
html,body{ width: 100%; height: 100%; } body{ margin: 0; background: url(img/bg.png) no-repeat; background-size: cover; }
转载于:https://www.cnblogs.com/yc-web/p/6995509.html