Why does a fixed-width label give the accepted behavior?

There are many questions about formatting forms so that labels align, and almost all answers that offer a clean CSS solution (as opposed to using a table) provide a fixed width for the label element.

But isn't this a mix of content and presentation? To select the desired width, you basically need to see how big your longest label is, and try the pixel width value until it โ€œfitsโ€. This means that if you change your labels, you also need to change your CSS.

+7
html css
source share
3 answers

I have no problem (Gasp! Heresy!) Using tables to align form elements and their labels. If that makes me a luddite, then so be it. I believe that it can be argued that the arrays of labels / input pairs are tabular enough to display tables.

+4
source share

Your labels can still span words, allowing them to be very short or very long. You do not limit your content at all ( almost ), you just dictate how they will be displayed.

+2
source share

Fixed width should not be in pixels. em is a valid and best block for text containers.

0
source share

All Articles