Captain's Universe Home
Captain's Universe Home
Cosmic Ray Muon DetectorTeleGarden Pages
Time on MarsBryophyllum Plants
Jupiter Radio AstronomyAncient Pages
Salzburg Tourist GuideEarth Magnetometer
  H O M E     AJAX & MORE     LINUX & MORE     RTAI     XENOMAI     ADEOS IPIPE      
    JAVA & BROWSERS     *NIX     ELECTRONICS     REVIEWS     ARTEMIA     FAIRY SHRIMP      


CSS Horizontal Alignment - CSS center table etc...

Alignment of tables etc. is easy with CSS - granted you have to know how it is done ;-)

The key to CSS alignment is the margin style:
e.g. margin-left: 0px; margin-right: auto; will align it to the left. Yeah, sure, that's boring, because things are aligned to the left by default by the browser.


margin-left: 0px; margin-right: auto;


... alignment to the right with CSS is not that exciting too, since there is the "float: right" stuff:


margin-left: auto; margin-right: 0px;


But when it comes to aligning stuff in the center of the page, table cell, or any HTML area, it is tricky. The only thing that will work is, setting the margin-left and the margin-right to auto, which will force the browser to calculate the layout so, that the widget appears in the middle of the page, table cell or anything else:


margin-left: auto; margin-right: auto;


Last-Modified: Sat, 04 Feb 2006 16:03:18 GMT

Google
 
Web www.captain.at
go to top
© 1996-2010 . All rights reserved.
No reproduction, distribution, publishing or transmission of the copyrighted materials at this site is permitted. Policy
go to top