How to set the picture size of img by css
This article mainly explains "css how to set the picture size of img", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "css how to set the picture size of img" bar!
In css, you can use the width and height attributes to set the size of the img element picture, the width attribute to set the width value of the element, and the height attribute to set the height value of the element. The syntax is "img element {width: width value; height: height value;}".
The operating environment of this tutorial: windows7 system, CSS3&&HTML5 version, Dell G3 computer.
How to set the picture size of img with css
In css, you can use the width and height properties to set the image size of img, as shown in the following example:
123 .tupian {width:150px; height:150px;}
The size is set above, but not below.
Output result:
In the above example, both the width and height properties are set, and to achieve proportional scaling, you only need to set one property. Examples are as follows:
When adding only width:150px; styles, output the result:
When adding only height:150px; styles, output the result:
Thank you for reading, the above is the content of "css how to set the picture size of img". After the study of this article, I believe you have a deeper understanding of how css sets the picture size of img. The specific use also needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!