Style Sheets
  Home arrow Style Sheets arrow Using the Text-align CSS Property to Cente...
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

Using the Text-align CSS Property to Center DIVs
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2009-03-26

    Table of Contents:
  • Using the Text-align CSS Property to Center DIVs
  • Creating a centered three-column web page layout: the structural markup
  • Styling the (X)HTML file: constructing a fully-centered web page layout
  • Merging the CSS styles and structural markup in one single file

  • 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


    Using the Text-align CSS Property to Center DIVs


    (Page 1 of 4 )

    Building fully-centered web page layouts with CSS can be more challenging than it appears at first glance. In this seven-part article series, we walk you through a variety of techniques that reduce the hassles you may face in achieving these layouts. In this second part of the series, we'll focus on a new way to use the text-align property.

    Introduction

    At first sight, building fully-centered web page layouts with CSS looks like an extremely easy process that can be tackled with minor hassles, since it requires only a basic background in coding HTML pages and working with a few simple style sheets. That’s it.

    Unfortunately, creating this kind of web design isn’t always as simple as it seems. Very often, it’s necessary to be aware of the pros and cons in using a particular DIV alignment technique, not to mention the numerous browser incompatibilities that must be properly addressed for achieving a consistent layout.

    Despite all of these inconveniences, there are a number of well-trusted CSS approaches that can be used for building centered web document layouts. These can be mastered in a short time, even by inexperienced designers. Based upon this concept, in this series of articles you’ll find a comprehensive guide to implementing several DIV centering methods for constructing both fixed and liquid web page designs.

    And speaking of liquid designs, you’ll possibly recall that in the previous article of this series, I demonstrated how to build a fully-centered web document layout whose main sections were created by using an elastic approach. In this particular case, the layout in question was centered across the whole web page by using the “text-align: center” CSS property, which was attached to the body element.

    Please note that this sample web document was comprised of the typical header and footer sections, and a single main area as well. Thus, it’d be pretty instructive to use the aforementioned CSS property to create a liquid layout that contains three main columns, in this way recreating a more realistic situation.

    Therefore, in this second episode of the series I’ll be explaining how to build this kind of centered web page layout by taking advantage of the functionality of the familiar “text-align” CSS property. Let’s jump in!

    More Style Sheets Articles
    More By Alejandro Gervasio


       · This second episode of the series explains how to build a more complex...
     

    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 3 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek