zl程序教程

您现在的位置是:首页 >  工具

当前栏目

CSS:背景设置~笔记

笔记CSS 设置 背景
2023-09-27 14:22:47 时间
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>背景</title>
        <style>
            div{
                width: 500px;
                height: 500px;
                /*背景颜色*/
                background-color: aqua;
                /*背景图片*/
                background-image: url("tangping.jpg");
                /*设置不平铺*/
                background-repeat: no-repeat;
                /*设置背景大小*/
                background-size: 500px 500px;
                /*背景定位*/
                background-position: center;/*其他的可以自己设置*/
                /*复合样式 background:颜色 图片 是否平铺 背景定位/背景大小*/
                background: red url("tangping.jpg") no-repeat center/200px 200px;
            }
        </style>
    </head>
    <body>
        <div>

        </div>
    </body>
</html>