Archive for the ‘CSS’ Category

Fix your tables: how to stop cells from expanding out of control

Tuesday, March 23rd, 2010

HTML tables receive a bit of a bad rap thanks to years of abuse in web design, however in reality they’re semantic as the next element. They do have their quirks though, one common problem is that instead of aligning themselves like the rigid blocks we’re used to they tend to be a bit more fluid – expanding and contracting to fit their content.

This useful behaviour can become frustrating when a carefully laid-out table encounters abnormal input and suddenly decides to stop paying attention to the cell widths we’ve specified. Luckily there is a simple solution to this. All the major browsers implement an alternative fixed table layout which is specified through the appropriately named table-layout CSS property. (more…)