Compare font size in pixel, point, inch, mm and em, ex in HTML and CSS
Description
The following code shows how to compare font size in pixel, point, inch, mm and em, ex.
Example
<html>
<head>
<style type='text/css'>
p {font-family:arial; font-size:12pt;}
<!--from w w w . j ava 2s . c o m-->
p.px {font-size:12px;}
p.pt {font-size:12pt;}
p.pc {font-size:2pc;}
p.in {font-size:0.5in;}
p.cm {font-size:1cm;}
p.mm {font-size:12mm;}
p.em {font-size:1.5em;}
p.ex {font-size:1.5ex;}
</style>
</head>
<body>
<h1>Lengths</h1>
<p class="px">The length used here is 12 px</p>
<p class="pt">The length used here is 12 pt</p>
<p class="pc">The length used here is 2 pc</p>
<p class="in">The length used here is 0.5in</p>
<p class="cm">The length used here is 1cm</p>
<p class="mm">The length used here is 12mm</p>
<p class="em">The length used here is 1.5em</p>
<p class="ex">The length used here is 1.5ex</p>
</body>
</html>
The code above generates the following result.
HTML CSS Tutorial Font Size
Compare all possible font size settings in ...
Compare font-size Properties in HTML and CS...
Compare font-size in HTML and CSS
Compare percentage font size in HTML and CS...
Compare seven different absolute size keywo...
Demonstrate that font-size larger is increm...
Demonstrate that font-size smaller is incre...
Set font-size to 0.75em; (25% smaller) in H...
Set font size to 120% for H1 in HTML and CS...
Set font size to 150% larger in HTML and CS...
Set font-size to 18px in HTML and CSS
Set font size to 1.2em in HTML and CSS
Set font-size to 1.5em; (50% larger) in HTM...
Set font size to 6em in HTML and CSS
Set font size to 80% smaller in HTML and CS...
Set font size to 90% for paragraph in HTML ...
Set font size to medium and larger in HTML ...
Set font size to small in HTML and CSS
Set font-size to smaller in HTML and CSS
Use calculation based font size in HTML and...
Compare all possible font size settings in ...
Compare font-size Properties in HTML and CS...
Compare font-size in HTML and CSS
Compare font size in pixel, point, inch, mm...
Compare larger and smaller keywords of the ...Compare percentage font size in HTML and CS...
Compare seven different absolute size keywo...
Demonstrate that font-size larger is increm...
Demonstrate that font-size smaller is incre...
Set font-size to 0.75em; (25% smaller) in H...
Set font size to 120% for H1 in HTML and CS...
Set font size to 150% larger in HTML and CS...
Set font-size to 18px in HTML and CSS
Set font size to 1.2em in HTML and CSS
Set font-size to 1.5em; (50% larger) in HTM...
Set font size to 6em in HTML and CSS
Set font size to 80% smaller in HTML and CS...
Set font size to 90% for paragraph in HTML ...
Set font size to medium and larger in HTML ...
Set font size to small in HTML and CSS
Set font-size to smaller in HTML and CSS
Use calculation based font size in HTML and...