css记录

40 阅读1分钟

一、背景图片拼接

前提:整个背景是图片,很长,没法垫一整张图,这时候需要把图片去切割,然后拼接显示,如下图

background-image:拼接两张图片

background-position:定位top,bottom

background-repeat:第一张图片不重复,后面重复第二张图片

background-size:等比例缩放

image.png

.item-top {
    background-image: url(./img/dark_bg_1.jpg), url(./img/dark_bg_2.png);
    background-position: top, bottom;
    background-repeat: no-repeat, repeat;
    background-size: 100% auto, 100% auto;
}