寬度屬性 – width
寬度值設定
| auto | 自動判斷寬度 |
| 寬度 | 單位px, em, cm |
| % | 百分比設定元素寬度 |
| inherit | 繼承父層寬度屬性值(IE 瀏覽器並不支援) |
最大寬度 – max-width
不能比其寬
| none | 預設值 |
| 寬度 | 單位px, em, cm |
| % | 百分比設定元素最大寬度 |
| inherit | 繼承自父層最小寬度屬性值(IE 瀏覽器並不支援) |
高度屬性 – height
高度參數值
| auto | 自動判斷元素高度 |
| 長度 | 單位px, em, cm |
| % | 百分比設定元素高度 |
| inherit | 繼承父層高度屬性值(IE 瀏覽器並不支援) |
最大高度屬性 – max-height
不能比其高
| auto | 自動判斷元素最大高度 |
| 長度 | 單位px, em, cm |
| % | 百分比設定元素最大高度 |
| inherit | 繼承父層最大高度屬性值(IE 瀏覽器並不支援) |
最小高度屬性 – min-height
不能比其小
| auto | 自動判斷元素最小高度 |
| 長度 | 單位px, em, cm |
| % | 百分比設定元素最小高度 |
| inherit | 繼承父層最小高度屬性值(IE 瀏覽器並不支援) |
RWD應用
圖片自適應基本設定。
img {
height: auto;
max-width: 100%;
}
圖片隨螢幕放大縮小。
<style>
.background
{
z-index:-2;
max-width: none !important;
image-rendering: optimizeQuality;
-ms-interpolation-mode: bicubic;
}
</style>
<img class="background" src="picname.jpg" style="position: fixed; left: 0px; top: 0px; width: 100%; height:100%; bottom: auto; right: auto;">