Topic: center a div that uses absolute positioning? (Page 1 of 1) |
|
---|---|
Nervous Wreck (II) Inmate From: Melbourne, Victoria, Australia |
![]() Hi, |
Maniac (V) Inmate From: Cell 666 |
![]()
|
Maniac (V) Inmate From: Den Haag: The Royal Residence |
![]() 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 |
![]() 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 |
![]() Some browser don't like the negative margin though and it looks like an ugly hack... code: .center{
|