CSS 中的绝对长度单位

cssweb developmentfront end technology更新于 2024/11/17 15:40:17

绝对长度单位彼此之间是固定的。这些单位用于已知输出格式的情况。以下是一些绝对长度单位 −

Sr.No单位和说明
1cm
centimeters
2mm
millimeters
3in
inches (1in = 96px = 2.54cm)
4px 
*pixels (1px = 1/96th of 1in)
5pt
points (1pt = 1/72 of 1in)
6pc
picas (1pc = 12 pt)

示例

<!DOCTYPE html>
<html>
<head>
<style>
.demo {
   text-decoration: overline underline;
   text-decoration-color: blue;
   font-size: 0.3in;
}
</style>
</head>
<body>
<h1>Details</h1>
<p class="demo">Examination Center near ABC College.</p>
<p class="demo2">Exam begins at 9AM.</p>
</body>
</html>

输出

示例

现在让我们看另一个例子 −

<!DOCTYPE html>
<html>
<head>
<style>
.demo {
   font-size: 1cm;
}
.demo2 {
   font-size: 5mm;
}
</style>
</head>
<body>
<h1>ICC Rankings</h1>
<p class="demo">ICC Test Rankings released 29th November.</p>
<p class="demo2">ICC ODI Rankings released 30th November.</p>
</body>
</html>

输出


相关文章


有用资源