css3提供的半透明效果

  1. 背景图片
    background:url('1.jpg')
  2. 默认是背景平铺的

    background-repeat:none|repeat|repeat-x|repeat-y

  3. 背景位置
            background-position:center center;
            background-position:left;如果只有一个,第二个一定是居中
            background-position:20px 20px
       background-position:20px与background-position:20px20px center是一样的
  4. 背影图像固定
     background-attachment: fixed;
  5. 背景颜色
  6. 复合属性写法
         background-color: pink;
            background-image: url('./ball.png');
            background-repeat: no-repeat;
            background-attachment: fixed;
            background-position: 10px 10px;
    用这种简等价上面的写法        
    background: pink url('./ball.png') no-repeat fixed 10px 10px;
  7. 背景半透明
    background-color: rgb(244 67 54 / 62%)

    最后一个参数alpha透明度 0-1 ,0是透明

 

       
     /*
         宽高等比缩放,缩放为父容器宽度的50%
        background-size: 50%;
         宽高等比缩放,宽度为200px
        background-size: 200px;
         宽高等比缩放,等比拉伸,可能部分图片显示不全
        background-size: cover;
         宽高等比拉伸,拉到宽度或者高度与父容器铺满就停止
        background-size: contain;
       */

  

 

posted on 2023-07-20 22:53  码农-编程小子  阅读(45)  评论(0编辑  收藏  举报