100字范文,内容丰富有趣,生活中的好帮手!
100字范文 > 从0开始html前端页面开发_CSS实现设置背景图自适应屏幕大小

从0开始html前端页面开发_CSS实现设置背景图自适应屏幕大小

时间:2022-10-16 23:36:48

相关推荐

从0开始html前端页面开发_CSS实现设置背景图自适应屏幕大小

只需要在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;}

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。