Home arrow Style Sheets arrow Centering DIVs with CSS
STYLE SHEETS

Centering DIVs with CSS


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.

Author Info:
By: Alejandro Gervasio
Rating: 5 stars5 stars5 stars5 stars5 stars / 2
March 19, 2009
TABLE OF CONTENTS:
  1. · Centering DIVs with CSS
  2. · Centering DIVs in a web document with the text-align CSS property
  3. · Aligning DIVs to the left side of the web page
  4. · The complete source code of the improved web page design

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Centering DIVs with CSS
(Page 1 of 4 )

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!


blog comments powered by Disqus
STYLE SHEETS ARTICLES

- CSS Combinators: Working with Child Combinat...
- CSS Combinators: Using General Siblings
- Intro to CSS Combinators
- CSS Semicircles and Web Page Headers
- Drawing Circular Shapes with CSS3 and Border...
- More CSS Pagination Link Templates
- CSS Pagination Links
- Animated CSS3 Image Gallery: Advanced Transi...
- CSS3 Animated Image Gallery: Transitions
- CSS3 Properties: Fixed Heights with box-sizi...
- CSS3 Properties: Altering Strokes and 3D Eff...
- CSS3 Properties: Text-Stroke
- CSS3 Transitions: Width and Height Properties
- Creating a Drop Down Menu in CSS3
- Intro to CSS Transitions

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 9 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials