您的位置:首页 > Web前端 > CSS

css中设置网页背景图片平铺但不重复

2014-09-06 15:24 691 查看
body

{

    background: url(../img/backgrounds/2.jpg) no-repeat center center fixed;

    -webkit-background-size: cover;

    -moz-background-size: cover;

    -o-background-size: cover;

   background-size: cover;//这条一定要

}

该设置对以下浏览器有效:
Safari 3+
Chrome Whatever+
IE 9+
Opera 10+ (Opera 9.5 supported background-size but not the keywords)
Firefox 3.6+ (Firefox 4 supports non-vendor prefixed version)

参考:http://css-tricks.com/perfect-full-page-background-image/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  html css url