HTML引用CSS实现自适应背景图

链接图片背景代码

body {background: url('链接') no-repeat center 0;}

颜色代码

body{background:#FFF} 

链接图片背景代码2

<body background="链接">

css实现自适应

.all_bg{
                position:fixed;
                top: 0;
                left: 0;
                width:100%;
                height:100%;
                min-width: 780px;
                z-index:-10;
                zoom: 1;
                background-color: #fff;
                background: url(背景链接);
                background-repeat: no-repeat;
                background-size: cover;
                -webkit-background-size: cover;
                -o-background-size: cover;
                background-position: center 0;
            }

 然后在 <body> 之间引用已下内容:

<div class="all_bg"></div>
posted @ 2022-01-30 09:47  小kBlog  阅读(454)  评论(0编辑  收藏  举报