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

Data in table cells can be horizontally aligned to the left, right, or center(1). They can be also aligned along a vertical axis according to a specified character(2).

XML SourceCSS stylesheetExample link
(1)
     <AAA>
          <BBB>
               <CCC>12.12</CCC>
               <DDD>xxxx d xxxx</DDD>
          </BBB>
          <BBB>
               <CCC>111112.12</CCC>
               <EEE>x e xxxx</EEE>
          </BBB>
          <BBB>
               <CCC>12.122222</CCC>
               <DDD>xxxxxxx d xx</DDD>
          </BBB>
     </AAA>

* {padding:1ex;}
AAA {display: table;}
BBB {display: table-row;}
CCC {display: table-cell; text-align: right}
DDD {display: table-cell; text-align:left}
EEE {display: table-cell; text-align:center}
CCC,DDD,EEE {border:solid}
View output
XML SourceCSS stylesheetExample link
(2)
     <AAA>
          <BBB>
               <CCC>12.12</CCC>
               <DDD>xxxx d xxxx</DDD>
          </BBB>
          <BBB>
               <CCC>111112.12</CCC>
               <EEE>x e xxxx</EEE>
          </BBB>
          <BBB>
               <CCC>12.122222</CCC>
               <DDD>xxxxxxx d xx</DDD>
          </BBB>
     </AAA>

* {padding:1ex;}
AAA {display: table;}
BBB {display: table-row;}
CCC {display: table-cell; text-align: "."}
DDD {display: table-cell; text-align:"d"}
EEE {display: table-cell; text-align:"e"}
CCC,DDD,EEE {border:solid}
View output