1020人加入学习
(2人评价)
Web前端第二季(CSS)

制作完成于2018年6月6日 CSS2.0,

价格 免费
<!DOCTYPE html>
<head>
    <meta charset="UTF-8">    
    <title>css样式设置背景颜色</title>
    <style type="text/css">
        body{
            background-color:transparent;
        }
        .one{
            width:800px;
            height:2000px;
            /* background-color:aqua;
            background-image:url(img/api.jpg);
            background-repeat:no-repeat;
            background-position:right top;
            background-position:30px 10px;
            background-attachment:fixed; */
            background:aqua url(img/api.jpg) no-repeat right top fixed;
        }
        /* .two{
            width:800px;
            height:2000px;
            background: green;
        } */
    </style>
</head>
<body>
    <div class="one">
        1sdfssjajdfaldfjoaldfladfls
        www.w3school.com.cn/cssref/pr_background.asp
    </div>
    <!-- <div class="two">
        1sdfssjajdfaldfjoaldfladfls
    </div> -->
</body>
</html>

同时设置了right top 和 fixed 就是以浏览器为基准。

[展开全文]

背景图片 优先于 背景颜色

等价于

background:green url(img/api.jpg) np-repeat top fixed;
[展开全文]

授课教师

SiKi学院老师

课程特色

下载资料(1)
视频(47)