July 7, 2011
Full CSS Fluid Squares (or Rectangles, or what-you-want-but-fluid)

It is possible to make full CSS fluid squares without images hack or javascript workarounds?

YES! Just think how paddings (and margins) works in the box-model definition.

If the vertical paddings (and margins) are specified in percent (%) values the size is a percent of the width of the containing element.

So if you write:

width: 50%;
height: 0;
padding-bottom: 50%;

you get a fluid square box with only a three row CSS declaration.

Have Fun!