Home  >  Article  >  Web Front-end  >  How to set css to hide overflow after image is enlarged

How to set css to hide overflow after image is enlarged

WBOY
WBOYOriginal
2021-12-10 18:21:274713browse

Method: 1. Add the "transform:scale (horizontal scaling value, vertical scaling value)" style to the image element to enlarge the image; 2. Use the overflow attribute to hide the overflowing part of the image element after enlarging it. The syntax is "the parent element of the picture element {overflow:hidden;}".

How to set css to hide overflow after image is enlarged

The operating environment of this tutorial: Windows 10 system, CSS3&&HTML5 version, Dell G3 computer.

How to hide the overflow after the image is enlarged in css

In css, you can use the transform attribute to enlarge the image. When this attribute is combined with the scale function When used, the element can be scaled. The syntax is as follows:

图片元素{transform:scale(横向缩放值,竖向缩放值);}

Then use the overflow attribute to hide the excess part. This attribute is used to set the style of the element beyond the element. When the attribute value is hidden, it will be hidden. elements beyond.

The syntax is as follows:

元素{overflow:hidden;}

The example is as follows:




  
  
  
  Document
  

Output result:

How to set css to hide overflow after image is enlarged

(Learning video Share: css video tutorial)

The above is the detailed content of How to set css to hide overflow after image is enlarged. For more information, please follow other related articles on 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