今天是: 收藏本站 设为主页
网站首页 >  技术专栏  >  div/css  > 

HTML 网页背景图片根据屏幕大小CSS自动缩放

日期:2013-07-20  点击率:10028


CSS 代码如下:

#background { position: fixed;top: 0;left: 0;width: 100%;height: 100%;overflow: hidden;background-color: #211f1f; display:none\8;}
#background .bg-photo {position: absolute;top: 0;left: 0;width: 100%;height: 100%;display: none;overflow: hidden;-webkit-background-size: cover !important;-moz-background-size: cover !important;-o-background-size: cover !important;background-size: cover !important;}

#background .bg-photo-1 { background: url('../image/alone.jpg') no-repeat center center;}

#background-ie { position: fixed;top: 0;left: 0;width: 100%;height: 100%;overflow: hidden;background-color: #211f1f;}
HTML代码如下:
<div id="background">
<div class="bg-photo bg-photo-1" style="display: block;"></div>
</div>




下一篇:Ubuntu configure: PHP编译出现的几个error   上一篇:Ubuntu编译Nginx