CSS:插入图片和背景图片的区别

1、插入图片我们用的最多,比如产品展示类,移动位置只能靠padding margin

2、背景图片我们一般用于小图标背景或者超大背景图片。移动位置只能通过background-position;

img{

    width:200px;
    height:200px;
    margin-top:30px;
    margin-bottom:40px;

}

div{
    width:200px;
    height:200px;
    background:url(images/1.png);
    background-position: 20px 30px;

}

猜你喜欢

转载自blog.csdn.net/baidu_24743861/article/details/107958849