CSS3背景样式扩展

background-size:背景图的尺寸大小

  • cover:覆盖

  • contain:包含

background-origin:背景图的填充位置

  • padding-box(默认值)

  • border-box

  • content-box

background-clip:背景图的裁切方式

  • border-box(默认值)

  • padding-box

  • content-box

CSS3渐变

linear-gradient:线性渐变,需要添加到background-image属性上

  • point || angle

  • color

  • percentage

radial-gradient:径向渐变

  • point

  • color

  • percentage

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>渐变 By ToDo Blog</title>
    <style>
        .box {
            width: 300px;
            height: 300px;
            border: 1px black solid;
            background-image: linear-gradient(90deg, red, blue);
        }
    </style>
</head>
<body>
    <div class="box"></div>
</body>
</html>

不起眼的小广告

do淘客