Home arrow Style Sheets arrow Using the Text-align CSS Property to Center DIVs
STYLE SHEETS

Using the Text-align CSS Property to Center DIVs


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.

Author Info:
By: Alejandro Gervasio
Rating: 5 stars5 stars5 stars5 stars5 stars / 1
March 26, 2009
TABLE OF CONTENTS:
  1. · Using the Text-align CSS Property to Center DIVs
  2. · Creating a centered three-column web page layout: the structural markup
  3. · Styling the (X)HTML file: constructing a fully-centered web page layout
  4. · Merging the CSS styles and structural markup in one single file

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Using the Text-align CSS Property to Center DIVs
(Page 1 of 4 )

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!


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 8 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials