One of the tenets of responsive web design is responsive images: sizing images using percentages rather than concrete values. This is done via CSS.
The problem I have is the standard practice of including the width
and height
attributes on the img
tag. This seems to be precluded by setting image sizes in CSS. For one, it's long been required to include the dimension attributes in the image tag. Also, these values were used to create space in the page before the image loaded.
As far as the sizing goes, I suppose it's possible to put the image into another element (e.g. figure
) and set the image's width in CSS to be 100%. But that then requires sizing the container, possibly as a percentage of the parent element, and so on.
Am I not thinking straight on this, or is setting image size in CSS at odds with using the width
and height
attributes?
width
andheight
attributes of theimg
element are not required under any DOCTYPE. There is no difference between Strict and Transitional in this respect. (If anything, however, it would be the other way around... less likely to be used under a Strict DOCTYPE since these are presentational attributes.)width
andheight
with CSS just fine without penalty.