Centering DIVs with CSS
(Page 1 of 4 )
Undoubtedly, one of the most common tasks that a web designer has to tackle when building the layout of a web document is centering the DIVs that comprise the document when using a table-less approach. If you’re starting to build your first centered web document layouts, then in this group of articles you’ll be provided with an approachable guide to several CSS-based techniques for creating this kind of web page design with minor hassles.
Introduction
Of course, as with many other topics within the huge terrain of professional web design, there are different methodologies that can be used for centering DIVs easily on a web page, and each of them has its own advantages and down sides. However, one thing is true in this case: all of these aligning techniques have been proven to be quite successful over time, and offer a very easy learning curve.
During this hopefully educational journey, you’ll learn how to utilize a few popular approaches that come in useful for aligning DIVs, ranging from working with the “text-align” CSS property and the body selector, to using more complex techniques, such as “auto” and evened margins. Of course, in all cases, these approaches will be utilized to build both fixed and liquid designs, which means that there’s a lot of material to learn regarding the alignment of DIVs within a web document.
Now that you’ve been introduced to the main subject of this series of articles, it’s time to get rid of the preliminaries and start learning several techniques that permit us to center the DIVs of a web page in a truly painless way. In this first part of the series, you’ll see how to achieve this by styling the “body” element, so let’s get started now!
Next: Centering DIVs in a web document with the text-align CSS property >>
More Style Sheets Articles
More By Alejandro Gervasio