I’ve struggled over the past couple years with including size=”xx” in input tags. My right brain says, “it’s presentational, nooooo!” My left brain says “but it makes the forms more predictable.”
Well, lo and behold, there’s a reason behind the madness. Bite Sized Standards has a new post that describes why the size attribute isn’t just a presentational element.
However, unlike the size attribute of the infamous <font> tag, size of <input> specifies a functional property. The length of an input field is a programmatical decision because it provides an important cue as to the type of input expected: a cue that should be preserved even when the page is not styled.
The advantage of using size becomes apparent when working with web applications that make extensive use of forms, often with different layouts. Instead of having a plethora of CSS classes for different input field sizes, we could simply set their widths using size.
Bite Sized Standards
So, let both sides of your brain feel good. Use the size on input elements and have a happy day after all.
Leave a Reply