Topic: center a div that uses absolute positioning? (Page 1 of 1) |
|
---|---|
Nervous Wreck (II) Inmate From: Melbourne, Victoria, Australia |
posted 07-18-2004 12:42
Hi, |
Maniac (V) Inmate From: Cell 666 |
posted 07-18-2004 16:40
How do I get vertical and horizontal centering with CSS? |
Maniac (V) Inmate From: Den Haag: The Royal Residence |
posted 07-18-2004 22:08
I have a some very rough examples for you using an very basic techique. The center content goes in an container div or span so does the content to the right and to the left. |
Paranoid (IV) Inmate From: Behind the Wheel |
posted 07-20-2004 09:00
I've found this to work rather well... You just set the width of the container div, then set the position (left) to 50%. That puts the left hand edge of the div in the center. Now pull it back half of the width of the div and you're at center code: #container { |
Maniac (V) Inmate From: Den Haag: The Royal Residence |
posted 07-20-2004 22:04
Some browser don't like the negative margin though and it looks like an ugly hack... code: .center{
|