Home  >  Article  >  Web Front-end  >  CSS adjusts the size of images. You need to know width and height.

CSS adjusts the size of images. You need to know width and height.

高洛峰
高洛峰Original
2017-02-08 10:11:332341browse

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:

CSS adjusts the size of images. You need to know width and height.

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:

CSS adjusts the size of images. You need to know width and height.

## 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!

Statement:
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