Style Sheets
  Home arrow Style Sheets arrow An Evened Margin Approach to Centering DIV...
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

An Evened Margin Approach to Centering DIVs with CSS
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 4
    2009-04-23

    Table of Contents:
  • An Evened Margin Approach to Centering DIVs with CSS
  • Using evened CSS margins with a fixed design: defining a sample web document
  • Working with evened CSS margins
  • Putting CSS styles and (X)HTML markup together

  • 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


    An Evened Margin Approach to Centering DIVs with CSS


    (Page 1 of 4 )

    In this sixth installment of a seven-part series on centering DIVs with CSS, I’ll be discussing how to build a fixed centered web page design by using evened CSS margins. You may want to use this technique for browser compatibility reasons, as I explain in the article. Let's get started.

    When it comes to creating centered web page layouts with CSS, things can get really interesting indeed, since this process can be tackled by means of several approaches that present a friendly learning curve.

    Ranging from using the CSS “text-align” property, to working with evened margins, there are plenty of solutions currently available for creating centered designs, and most of these techniques are cross-browser compatible.

    Nonetheless, learning how to use all these CSS approaches in concrete situations requires a bit of theory and lots of practice. Thus, if you’re seeking a guide that walks you through creating centered web page layouts by using only a few simple CSS styles and basic markup, then this group of articles might be what you’re looking for.

    Of course, if you already read all of the preceding tutorials of this series, then hopefully you’ll be familiar with utilizing some CSS properties for quickly constructing centered designs. Speaking more specifically, in the previous article I explained how to implement this kind of design when working with a web page comprised of three main columns.

    In that case, the whole web document was centered via CSS auto-margins, that is, by specifying a value of “auto” for the left and right margins of a main wrapping DIV. It was that simple, actually.

    Nevertheless, there’s a down side to using CSS auto-margins: Internet Explorer 6 and below will render them incorrectly when used in Quirks Mode. Obviously, this issue may very quickly break a web page layout that relies on this approach, so it’s necessary to look into another DIV-centering method that offers cross-browser support.

    Here’s where evened margins come in. It’s feasible to center a DIV on a web document by assigning the same values for its respective left and right margins. This method is supported pretty well by many modern browsers, including Internet Explorer.

    Therefore, click on the link below and roll up your sleeves. We're about to get to work!

    More Style Sheets Articles
    More By Alejandro Gervasio


       · This sixth installment of the series discusses how to build a fixed centered web...
       · I should have kept reading before commenting! It appears you've got the <link> issue...
       · Apologies accepted. It happens very often.Regards.
     

    STYLE SHEETS ARTICLES

    - 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...
    - Pulling Web Page Elements with the Blueprint...
    - Pushing Web Page Columns with the Blueprint ...
    - Controlling Column Padding with the Blueprin...
    - Prepending Classes in the Blueprint CSS Fram...
    - Appending Grid Units with the Blueprint CSS ...
    - Changing Grid Units in the Blueprint CSS Fra...
    - The Blueprint CSS Framework
    - Building a Liquid Design with Evened Margins...







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    Stay green...Green IT