css3提供的半透明效果
- 背景图片
background:url('1.jpg') -
默认是背景平铺的
background-repeat:none|repeat|repeat-x|repeat-y
- 背景位置
background-position:center center;
background-position:left;如果只有一个,第二个一定是居中
background-position:20px 20px
background-position:20px与background-position:20px20px center是一样的 - 背影图像固定
background-attachment: fixed; - 背景颜色
- 复合属性写法
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; - 背景半透明
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;
*/
人生旅途,边走边看...
浙公网安备 33010602011771号