>> English << | česky | PortuguêsZVON > Tutorials > CSS2 tutorial
>> Example 26 << | Prev | Next | Index | Contents

The distance between individual letters in a word can be determined with letter-spacing property (1), the distance between words with word-spacing property (2). The distance can be given in several units. The relative distances are em (font-size of relevant font), ex (x-height of relevant font), and px (pixels, relative to viewing device). The x-height is so called because it is often equal to the height of the lowercase "x". Absolute length units are only useful when the physical properties of the output medium are known. The absolute units are: in: inches -- 1 inch is equal to 2.54 centimeters, cm: centimeters, mm: millimeters, pt: points -- the points used by CSS2 are equal to 1/72th of an inch, pc: picas -- 1 pica is equal to 12 points.

XML SourceCSS stylesheetExample link
(1)
     <AAA>
          <BBB>bbb bbb bbb</BBB>
          <CCC>ccc ccc ccc</CCC>
          <DDD>ddd ddd ddd</DDD>
          <EEE>eee eee eee</EEE>
     </AAA>

* {padding:10px}
BBB {letter-spacing: 1em}
CCC { letter-spacing: 3ex }
DDD { letter-spacing: 1cm }
EEE {letter-spacing: 8 mm }
View output
XML SourceCSS stylesheetExample link
(2)
     <AAA>
          <BBB>bbb bbb bbb</BBB>
          <CCC>ccc ccc ccc</CCC>
          <DDD>ddd ddd ddd</DDD>
          <EEE>eee eee eee</EEE>
     </AAA>

* {padding:10px}
BBB {word-spacing: 1em}
CCC { word-spacing: 3ex }
DDD { word-spacing: 1cm }
EEE {word-spacing: 8 mm }
View output