前端day10-背景

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>背景</title>

    <style>
        /* 背景色bgc */
        .b0 {
            width: 100px;
            height: 100px;
            background-color: pink;
        }

        /* 背景图bgi */
        /* 当范围大于图片,图片会重复出现 */
        .b1 {
            width: 600px;
            height: 600px;
            background-image: url(image/i1.png);
        }

        /* 背景平铺bgr */
        .b2 {
            width: 600px;
            height: 600px;
            background-color: palevioletred;
            background-image: url(image/i1.png);
            /* 不平铺 */
            background-repeat: no-repeat;
            /* 沿着水平和垂直方向都平铺,默认 */
            /* background-repeat: repeat; */
            /* 沿着水平方向平铺 */
            /* background-repeat: repeat-x; */
            /* 沿着垂直方向平铺 */
            /* background-repeat: repeat-y; */
        }

        /* 背景位置bgp */
        /* background-position:水平位置 垂直位置 */
        /* 水平: left right center 数字像素 */
        /* 垂直: top center bottom 数字像素 */
        /* 正数向右或下,负数向左或上 */
        .b3 {
            width: 600px;
            height: 600px;
            background-color: palevioletred;
            background-image: url(image/i1.png);
            background-repeat: no-repeat;
            /* background-position: center center; */
            background-position: center;
        }

        /* 背景复合属性的连写,且位置没有固定 */
        /* color image repeat position(英文可颠倒,数字不行) */
        .b4 {
            width: 600px;
            height: 600px;
            background: pink url(image/i1.png) no-repeat right bottom; 
        }
    </style>
</head>
<body>
    <!-- 背景色 -->
    <div class="b0"></div>

    <hr>

    <!-- 背景图片 -->
    <div class="b1"></div>

    <hr>

    <!-- 背景平铺 -->
    <div class="b2"></div>

    <hr>

    <!-- 背景位置 -->
    <div class="b3"></div>

    <hr>

    <!-- 背景复合属性 -->
    <div class="b4"></div>


</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值