HTML, width, and height
Published on Feb 17, 2011 (updated Feb 5, 2024), filed under development, html, maintainability. (Share this post, e.g., on Mastodon.)
This and 133 other posts are also available as a well-behaved ebook: On Web Development.
As the width and height attributes are to remain part of HTML, limit their use.
The reason to avoid @width and @height is that they are presentational and hence constitute potential maintainability issues.
The only reasons to ever use @width and @height—alleviating excessive “page jump” issues on page load, providing information about the intrinsic dimensions of the replaced element in question, if necessary, or overwriting such dimensions—should rather be addressed over context, as in #gallery img { height: 100px; width: 100px; }, or over the explicitly presentational style attribute.
About Me
I’m Jens (long: Jens Oliver Meiert), and I’m an engineering lead, guerrilla philosopher, and indie publisher. I’ve worked as a technical lead and manager at various companies (e.g., Google); I’m an active web and tool developer (code optimization, digital defense), a contributor to web standards (like HTML, CSS, WCAG), and a book author (O’Reilly, dxsrc). You’ll like my work if you value pragmatic, proactive problem-solvers. Let’s connect.
