A scary question about the height and width of images_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:52:39
Original
868 people have browsed it

Everyone knows that the img tag is an inline element, and inline elements do not have height and width by default. So the question is, why does setting the height and width of img take effect by default?


Reply to discussion (solution)

By default it can be set like this

I?? went through the w3c rules?
Original text: http://www.w3.org/TR/html-markup/img.html

It is mentioned below
Typical default display properties

img {display: inline-block; }
Copy after login


As for why the main console of the browser is inline, I don’t know.

If the img does not set the width and height, the default width and height will be the size of the loaded image. Setting After changing the width and height, the image will be stretched/compressed accordingly.
It should be the particularity of img, which requires processing of the image, so setting the width and height of this tag is effective

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template