17、CSS background背景调整

2022-06-04  本文已影响0人  小黄不头秃

一、背景设置

设置背景图片的范围:

二、代码

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>背景</title>
    <style>
        .box1{
            width: 500px;
            height: 500px;
            background-color:#bfa ;
            background-image: url("../photo/jd1.jpg");
            background-repeat: no-repeat;
            background-position: center;
            background-attachment: fixed;
        }
    </style>
</head>
<body>
    <div class="box1"></div>
</body>
</html>
上一篇 下一篇

猜你喜欢

热点阅读