Responsive Design does not normally use any width or height attributes
Google Development Tools is a guide and you shouldn't need to enforce everything you read on their site, in fact some of the stuff is outdated. The majority of responsive websites do not use width
or height
because they want the images to adapt to the screen size and by using fixed width and height using <img>
which would dampen user experience and Google has declared this one of the most important factors.
CSS Workaround
You could opt to use a block level element that has the width and height, personally I wouldn't use one but here is what Google says about block level.
Be sure to specify dimensions on the image element or block-level
parent
Be sure to set the dimensions on the element itself, or a block-level parent. If the parent is not block-level, the dimensions
will be ignored. Do not set dimensions on an ancestor that is not an
immediate parent.
I imagine this would look something like:
Static Design .ic {width:500px;height:500px;}
Responsive Design:
@media only screen and (max-width: 40em){.ic{width:1px;height:1px;}} Mobiles
@media only screen and (min-width: 40.063em){.ic{width:1px;height:1px;}} Tablets
@media only screen and (min-width: 40.063em) and (max-width: 64em){.ic{width:1px;height:1px;}} Small Screens
@media only screen and (min-width: 64.063em){.ic{width:1px;height:1px;}} Large Screens
Then you would need to use JavaScript or another solution to detect viewpoint and serve 4 different versions of the image, which again is less than practical. So if you are using responsive design then I would safely go ahead and not bother adding width and height so that your website is fluid no matter what screen views it.