• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 5. Layout > Centering Layouts Horizontally and Vertically

Centering Layouts Horizontally and Vertically

Earlier in this chapter, when I was showing you how to create a simple column layout, I used an easy technique to horizontally center the columns in the middle of the page by setting the margins for the content to auto for the left and right: margin: 0px auto;

Centering the content vertically, though, is a bit more challenging. It would be great if we could simply use auto for that as well, but neither life nor Web design always works out the way we would like it to, at least not in all browsers. Instead, we will need to combine two layers together, adjusting the margin and absolute positioning.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint