CSS 尺寸 (Dimension)
CSS 尺寸(Dimension)屬性
| #屬性 | ##描述|
|---|---|
| 設定元素的高度。 | |
| 設定行高。 | |
| 設定元素的最大高度。 | |
| 設定元素的最大寬度。 | |
| 設定元素的最小高度。 | |
| 設定元素的最小寬度。 | |
| 設定元素的寬度。 |
範例
#使用百分比設定影像的高度
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>php中文网(php.cn)</title>
<style>
html {height:100%;}
body {height:100%;}
img.normal {height:auto;}
img.big {height:30%;}
img.small {height:10%;}
</style>
</head>
<body>
<img class="normal" src="/upload/course/000/000/006/5809800b44336872.jpg" width="95" height="84" /><br>
<img class="big" src="/upload/course/000/000/006/5809800b44336872.jpg" width="95" height="84" /><br>
<img class="small" src="/upload/course/000/000/006/5809800b44336872.jpg" width="95" height="84" />
</body>
</html>執行程式嘗試一下
實例
#設定元素的最低高度
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>php中文网(php.cn)</title>
<style>
p
{
min-height:100px;
background-color:yellow;
}
</style>
</head>
<body>
<p>这一段的最小高度设置为100 px。</p>
</body>
</html>###執行程式嘗試########################
新建檔案
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>php中文网(php.cn)</title>
<style>
html {height:100%;}
body {height:100%;}
img.normal {height:auto;}
img.big {height:30%;}
img.small {height:10%;}
</style>
</head>
<body>
<img class="normal" src="https://img.php.cn/upload/course/000/000/006/5809800b44336872.jpg" width="95" height="84" /><br>
<img class="big" src="https://img.php.cn/upload/course/000/000/006/5809800b44336872.jpg" width="95" height="84" /><br>
<img class="small" src="https://img.php.cn/upload/course/000/000/006/5809800b44336872.jpg" width="95" height="84" />
</body>
</html>
預覽
Clear
- 課程推薦
- 課件下載
課件暫不提供下載,工作人員正在整理中,後期請多關注該課程~ 















