background示例一

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      div {
          margin: 0px;
          padding: 0px;
      }
      div.box{
          width: 300px;
          height: 300px;
          border:10px double red;
          padding:10px;
          /* 设置背景图片 */
         background-image:url("./source/img/1.jpg");
         /* 设置背景颜色 */
         background-color:aqua;
         /* 设置背景图片大小 */
         background-size:100px auto;
         /* 设置背景图片是否重复 */
         background-repeat: no-repeat;
         /* 设置背景图片的位置  两位参数x轴 y轴 */
         background-position: 10px 0px;
         /* 从内边距处开始计算原点 */
         background-origin:padding-box;
         /* 设置背景范围 */
         background-clip:content-box;
         
      }
    </style>
  </head>
  <body>
    <div class="box"></div>
  </body>
</html>
posted @ 2020-02-14 15:38  玄空2  阅读(183)  评论(0编辑  收藏  举报