12 pixel base : measurement « Style Basics « HTML / CSS






12 pixel base

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <title>12 pixel base</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

  <style type="text/css">
    * {font-family:arial, verdana, sans-serif;}
  #page {width:400px;}

    body   {font-size:100%;}       /* ensure IE scales correctly */
    p      {font-size:0.75em;}     /* 16 x 0.75  = 12 */ 
    h1     {font-size:1.5em;}      /* 16 x 1.5   = 24 */
    h2     {font-size:1.3em;}      /* 16 x 1.125 = 18 */
    h3     {font-size:1em;}        /* 16 x 1.125 = 18 */  
    h4     {font-size:0.875em;}    /* 16 x 1.143 = 14 */ 
  </style>

</head>

<body>

  <div id="page">
    <h1>Primary Heading</h1>
    <p>Here is some sample text</p>
<p>Here is some sample text</p>
    <h1>Secondary Heading</h1>
<p>Here is some sample text</p>
<p>Here is some sample text</p>
<p>Here is some sample text</p>

    <h1>Tertiary Heading</h1>
<p>Here is some sample text</p>
<p>Here is some sample text</p>
<p>Here is some sample text</p>
<p>Here is some sample text</p>
<p>Here is some sample text</p>

  </div>

</body>
</html>

   
  








Related examples in the same category

1.Absolute Units
2.Relative Units
3.Testing 96 DPI Equals an Inch
4.This paragraph has a 200 pixel width and 10 pixels of padding
5.Relative units giving rise to unequal side margins
6.Different measures
7.em is relative to the font size
8.Relative size font-size: .75em
9.width: size an element by assigning pixels, ems, a percentage, or another fixed measurement to width.
10.Percentages are more flexible because they can scale to the viewport.
11.width:100% stretches an element to the width of its parent.
12.Units of Length and Percentage
13.Absolute vs. Relative Measurements
14.one inch tall
15.inch measurement
16.font-size with various measurements
17.This font is 24 pixels tall and this div is 3 ems tall
18.The body's border is 1em thick
19.font-size: 1in
20.inch vs pixel
21.percentage measurement width
22.A negative margin
23.This paragraph has a 1 pixel thick, solid black border around it.
24.Comparing em to Pixels
25.This font is 1.2 smaller than the default size, or pixels.
26.em measurement
27.ex measurement
28.inch measurement 2
29.inch vs pixels
30.Em Measurement Comparison to Pixels
31.percentage measurement