原圖片和html的圖片就是上面的
5 回答

zhangcl
TA貢獻(xiàn)12條經(jīng)驗(yàn) 獲得超7個(gè)贊
來給你個(gè)萬能的
background:url(path) no-repeat center/cover;
其中center/cover分別表示background-position和background-size。
注意在background里面用size的時(shí)候必須先用position,后面加上/,不能單用size。
cover可以改成contain或者實(shí)際寬高像素、百分比。
設(shè)置好div的width和height就可以
添加回答
舉報(bào)
0/150
提交
取消