I like to know,how we can bring a div to the center of the screen,both horizontally and vertically using CSS and 960.gs
Asked
Active
Viewed 3,284 times
2
-
@Mr.Pallazzo : i asked help for CSS code – Alex Mathew May 05 '12 at 10:48
2 Answers
2
960.gs is not about centering relatively (ie using percentages). It's about picking a width of the page (960 px in this case) and dividing it up. You can 'center' divs by picking the grid you want to start on and picking the width to be (total grids - start grid).
For simple centering horizontally of your grid itself, you can do what is in the 960.gs demo:
.container_12 {
margin-left: auto;
margin-right: auto;
width: 960px;
}

Scott
- 16,711
- 14
- 75
- 120
1
div {
position:absolute;
left: 50%;
top: 50%;
width:""px;
height:""px;
margin:half the length of width; half the length of height;
}

SiriusKoder
- 341
- 2
- 4
- 12