Home > Article > Web Front-end > CSS adjusts the size of images. You need to know width and height.
What we are learning today is to teach you how to use CSS to adjust the size of images. In the previous course examples, we came into contact with the two properties of width and height. These two properties are used to set the width and height of elements respectively. of.
In CSS, we also use width and height to define the size of images. Grammar:
Description: In the beginner stage of CSS, all units are pixels. In the advanced stage of CSS, we will explain other CSS units in depth. Examples:
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <style type="text/css"> img{width:60px;height:60px;} </style> </head> <body> <img src="../App_images/lesson/run_cj/cartoongirl.gif" alt=""/> </body> </html>
The preview effect in the browser is as follows:
## Analysis: No matter what the actual size of the image is, you can use width and height to define the height and height you want. width. Don’t be so stupid as to use PS to make the height and width before you dare to use that picture on the page. For more CSS to adjust the size of images, if you want to know about width and height related articles, please pay attention to the PHP Chinese website!