网页设定固定背景图片(抄袭自百度FM)

这个新技能,我是从百度FM中学习到的。

在网页中,有一个id为"body-bg"的层,

html代码:

<div id="body-bg" style="display: block;">
  <
img src="http://mu6.bdstatic.com/static/fm/1403504178/themes/public-bg9.jpg">
</
div>

css代码:

#body-bg {
   position: fixed;
   bottom: 0;
   left: 0;
   z-index: -999;
   overflow: hidden;
   width: 100%;
   height: 100%;
   min-height: 100%;
   _position: absolute;
}

这是我从百度FM中找到在代码,你可以用上面的代码尝试一下。

工作了两年了,css没有用到这么好,有很多需要好好学习,特别需要多操作,才能真正的提高自己的技能。

原文地址:https://www.cnblogs.com/fsong/p/3903513.html