What's the difference between the HTML width / height attribute and the CSS width / height property on the img element?

前端 未结 7 1148
说谎
说谎 2020-12-02 01:34

The HTML element can have the width / height attribute, and it can also have the CSS width /

相关标签:
7条回答
  • 2020-12-02 02:21

    I made a comparison up at: http://jsfiddle.net/jF8y6/ with 4 different states. The main difference is the way it is used via external stylesheets in terms of the ability to resize images for different stylesheets (desktop, mobile, print, etc) and the flexibility it brings. If you hardcode the sizes then it stops the flexibility.

    0 讨论(0)
提交回复
热议问题