从0开始html前端页面开发_CSS实现设置背景图自适应屏幕大小
2018-03-06 14:21
921 查看
只需要在css样式里对BODY元素添加css样式即可
html代码如下<STYLE TYPE="text/css">
BODY {background-image: URL(../../ui/loading/loading_page.png);
background-position: center;
background-repeat: no-repeat;
background-attachment: fixed;
}
</STYLE>
元素介绍:
要显示的背景图URL地址!
background-image:背景图的起始位置
background-position: bottom; 可取以下参考属性
设置背景图的平铺模式
background-repeat;可取以下参考属性
no-repeat//不允许平铺
需要设置background-attachment属性才能确保在Firefox 和 Opera中正常显示
background-attachment可取以下参考属性:fixed
css代码BODY {background-image: URL(../../ui/loading/loading_page.png);
background-position: center;
background-repeat: no-repeat;
background-attachment: fixed;
}
html代码如下<STYLE TYPE="text/css">
BODY {background-image: URL(../../ui/loading/loading_page.png);
background-position: center;
background-repeat: no-repeat;
background-attachment: fixed;
}
</STYLE>
元素介绍:
要显示的背景图URL地址!
background-image:背景图的起始位置
background-position: bottom; 可取以下参考属性
属性值 | 说明 |
---|---|
top left | 左上 |
top center | 靠上居中 |
top right | 右上 |
left center | 靠左居中 |
center center | 正中 |
right center | 靠右居中 |
bottom left | 左下 |
bottom center | 靠下居中 |
bottom right | 右下 |
background-repeat;可取以下参考属性
no-repeat//不允许平铺
需要设置background-attachment属性才能确保在Firefox 和 Opera中正常显示
background-attachment可取以下参考属性:fixed
css代码BODY {background-image: URL(../../ui/loading/loading_page.png);
background-position: center;
background-repeat: no-repeat;
background-attachment: fixed;
}
相关文章推荐
- 如何通过CSS实现背景图片自动平铺或拉伸至整个屏幕(自适应大小)
- 不同css样式适应不同屏幕大小实现自适应宽度
- html5实现图片自适应手机屏幕页面的css
- css元素背景图片自适应屏幕大小
- react-native如何将UI设计稿上的原型的大小转换为开发大小,还能实现各种屏幕自适应
- 为Html页面设置背景——通过设置body结构标签和CSS指定背景属性实现
- css实现背景图片自适应大小
- 【CSS背景图片页面自适应充满屏幕】
- css 背景图不拉伸自适应屏幕大小
- css---pc、无线如果通过js获取屏幕宽度结合sass实现自适应页面
- css -- 背景图片自适应屏幕大小
- 使用css 实现图片自适应大小
- Android开发 屏幕大小自适应
- (开发篇) 前端开发~ css设置图片背景透明度
- 用CSS设置多个背景、背景渐变、指定背景大小
- Android开发屏幕大小自适应
- Android开发之屏幕大小自适应
- 背景图片百分之百大小css设置方法
- css:实现图片自适应大小
- 用网页技术CSS实现网页背景渐变的四种代码设置