Snippets | Nomads | Projects | Applications


Index | PHP | CSS | JS | Feature


Centering Things

Or "Frustrations with CSS:"



A few key points:

We have to start with the obvious... HTML is not a layout language. Some very good thoughts were applied at the beginning about content being the important thing as opposed to layout. With layout being flexible to allow for the variety of screen sizes and shapes, and of different user needs for accessibility. That said, most of the time web-design has been handed to folks that work visually, that think in terms of layout... So there has been a tug-of-war between layout and content and the code to provide both. CSS was introduced as a tool to help address the problem, but really it introduces more flexibility while helping to keep content and layout better separated. However, with more tools there are more options for control of layout, and more ways for things to get out of hand; but the underlying structure still hasn't changed and layout remains problematic around the edges - when screen-sizes are too different or accessibility issues change the display rules.

This page is an effort to give a few methods for centering things, but with a little more explanation of why and how the method works as well as where it runs into problems.