SitePoint Sponsor |
|
User Tag List
Results 1 to 4 of 4
Thread: center design using css
-
May 25, 2005, 05:08 #1
- Join Date
- Nov 2003
- Location
- shropshire uk
- Posts
- 18
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
center design using css
How do i center a design vertically and horizontally in the browser window using CSS.
-
May 25, 2005, 05:13 #2
-
May 25, 2005, 05:13 #3
- Join Date
- Jul 2003
- Location
- Springfield, MO
- Posts
- 1,867
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Depends on how you layout your page. If its a fixed width layout with a wrapper div surrounding your "columns" as in floating, setting the wrapper's left and right margin to auto will do the trick.
If you use absolute positioning, you'll have to surround the absolutely positioned div's in a relative positioned container and calculate the total width and apply it to this container. This is explained in Paul's FAQ.
-
May 25, 2005, 05:31 #4
- Join Date
- Jan 2003
- Location
- Hampshire UK
- Posts
- 40,556
- Mentioned
- 183 Post(s)
- Tagged
- 6 Thread(s)
Hi,
For elements of known dimensions you can do something like this assuming you are centering within the viewport.
http://www.pmob.co.uk/temp/flashbg.htm
Vertical centering is unfortunatley a little complicated in css and the method used depends on the situation in hand.
Bookmarks