CSS——设置背景

时光毁灭记忆、已成空白 提交于 2019-11-28 16:03:58

 

<!DOCTYPE html>
<html>

    <head>
        <meta charset="UTF-8">
        <title>CSS</title>
        <style type="text/css">
            #style1 {
                font-family: "微软雅黑";
                position: absolute;
                left: 340px;
                top: 123px;
                width: 98px;
                height: 90px;
                background-color: aliceblue;
            }
            
            #style2 {
                font-family: "微软雅黑";
                position: absolute;
                left: 540px;
                top: 223px;
                width: 234px;
                height: 317px;
                background-image: url(img/1511498485601.jpeg);
            }
        </style>
    </head>

    <body bgcolor="aquamarine">

        <div id="style1">

            床前明月光,<br> 疑是地上霜。
            <br> 举头望明月,
            <br> 低头思故乡。

        </div>
        <div id="style2">

        </div>

    </body>

</html>

width和height用来控制选区的大小;left、right、top用来控制选区在页面中的位置;background-color: 用来设置背景颜色;background-image:用来设置背景图片。

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!