CSS - 插入圖片img和背景圖片
阿新 • • 發佈:2018-05-09
images order solid fff side 展示 PE add 圖標背景
1. img插入圖片,用的最多,比如產品展示類
.section img {
width: 200px;/* 插入圖片更改大小 width 和 height */
height: 210px;
margin-top: 30px; /* 插入圖片更改位置 可以用margin 或padding 盒模型 */
margin-left: 50px; /* 插入當圖片也是一個盒子 */
}
2. 背景圖片一般用於小圖標背景或者超大背景圖片
.aside { width: 400px; height: 400px; border: 1px solid purple; background: #fff url(images/sun.jpg) no-repeat; background-size: 200px 210px; /* 背景圖片更改大小只能用 background-size */ background-position: 30px 50px; /* 背景圖片更該位置 用 background-position */ }
CSS - 插入圖片img和背景圖片