How does css change the size of a picture
This article will explain in detail how css changes the size of the picture. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
There are two ways to change the size of the picture: one is to change the width and height within the HTML tag, and the other is to use the CSS style to control the width and height properties.
Let's first look at changing the width and height of the image within the HTML tag.
You can control the width and height of the picture by using the width and height attributes directly in the picture img tag.
The code is as follows
one
two
three
four
five
six
seven
eight
nine
ten
The effect is as follows (the original image is 1072x768px):
We can set width and height directly in the image tab, which will look very intuitive.
Next, let's look at using CSS styles to control width and height properties.
We use the same picture, the code is as follows
one
two
three
four
five
six
seven
eight
nine
ten
eleven
twelve
thirteen
fourteen
fifteen
sixteen
Img {
Width: 150px
Height: 150px
}
The effect is as follows: the picture has also become 150x150px
This is the end of the article on "how to change the size of a picture in css". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.