css之颜色背景


css之颜色背景

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .c1 {
            background-color: lightblue;
        }
    </style>    
</head>
<body>

<div class="c1">大头</div>
</body>
</html>

upload successful

图片背景填充

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .c1 {
            background-color: lightblue;
        }
        .c2 {
            width: 800px;
            height: 800px;
            background-image: url("https://image-1259117942.cos.ap-shanghai.myqcloud.com/CDN/medias/logo.png");
            background-repeat: no-repeat;
        }
    </style>
</head>
<body>

<div class="c1">千里</div>
<div class="c2"></div>
</body>
</html>

upload successful

图片居中

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .c1 {
            background-color: lightblue;
        }
        .c2 {
            border: 1px solid red;
            width: 800px;
            height: 800px;
            background-image: url("https://image-1259117942.cos.ap-shanghai.myqcloud.com/CDN/medias/logo.png");
            background-repeat: no-repeat;
            /*background-position: 100px 200px;*/
            background-position: center;
        }
    </style>
</head>
<body>

<div class="c1">千里</div>
<div class="c2"></div>
</body>
</html>

Author: 千里
Reprint policy: All articles in this blog are used except for special statements CC BY 4.0 reprint policy. If reproduced, please indicate source 千里 !
  TOC