Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does css change the size of a picture

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report