Style Sheets
  Home arrow Style Sheets arrow Centering DIVs with CSS
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
STYLE SHEETS

Centering DIVs with CSS
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2009-03-19

    Table of Contents:
  • Centering DIVs with CSS
  • Centering DIVs in a web document with the text-align CSS property
  • Aligning DIVs to the left side of the web page
  • The complete source code of the improved web page design

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    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!

    More Style Sheets Articles
    More By Alejandro Gervasio


       · Centering DIVS is a really simple task with CSS. However, there’re different...
     

    STYLE SHEETS ARTICLES

    - Image Replacement CSS Techniques
    - Using BlueTrip`s Success, Notice and Error C...
    - More Uses for the Thin and Caps CSS Classes ...
    - Styling Definition Lists with the BlueTrip C...
    - Styling Unordered and Ordered HTML Lists wit...
    - Using the BlueTrip CSS Framework`s Thin and ...
    - Adding Borders to Web Page Columns with Blue...
    - Introducing the BlueTrip CSS Framework
    - Using a Background Grid to Assist Web Page L...
    - Extending the Rule Of Thirds for Web Page La...
    - A Two-Column Web Page Layout Based on the Ru...
    - Using the Rule Of Thirds for Web Page Layout
    - Swapping Columns Using the Divine Ratio for ...
    - Using the Golden Ratio in Liquid Web Page De...
    - Fundamental Design Principles for Web Page L...







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek