Home  >  Article  >  Web Front-end  >  Implementation methods and codes for controlling image size display using css_Experience exchange

Implementation methods and codes for controlling image size display using css_Experience exchange

WBOY
WBOYOriginal
2016-05-16 12:08:171457browse

Sometimes images are too large and disrupt the neat layout of the web page. At this time, you can use css to force the height or width of the image to be compressed proportionally
The css code is as follows:
img,a img{
border:0;
margin:0;
padding:0 ;
max-width:590px;
width:expression(this.width>590?"590px":this.width);
max-height:590px;
height:expression(this. height>590?"590px":this.height);
}
In this way, if the height or width of the image exceeds 590px, it will be proportionally compressed to 590px. If it does not exceed, it will be displayed at the original size.

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