css基础-背影颜色

MingDao / 2023-07-21 / 原文

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是透明