Absolute Length Units in CSS

CSSWeb DevelopmentFront End Technology

The absolute length units are fixed in relation to each other. These units are used when the output format is already known. Following are some of the Absolute Length Units −

Sr.NoUnit & Description
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)

Example

 Live Demo

<!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>

Output

Example

Let us now see another example −

 Live Demo

<!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>

Output

raja
Published on 30-Dec-2019 09:46:01
Advertisements