What's the difference between HTML's and CSS's width attribute?

后端 未结 7 1989
走了就别回头了
走了就别回头了 2020-11-29 07:49

The codes can be found here:

http://www.w3schools.com/css/tryit.asp?filename=trycss_float_elements




&l         


        
7条回答
  •  忘掉有多难
    2020-11-29 08:16

    The widths given in the markup are semantic statements about how large the image is. For that reason, in HTML5 it is only valid to give the dimensions in pixels.

    The widths given in the CSS are directives to the layout engine as to how much space to use when put the images on screen. They can be in any standard CSS units

    See BoltClock's answer for how they interact when laying the page out.

提交回复
热议问题