Home  >  Article  >  Web Front-end  >  How to scale images in in html_html/css_WEB-ITnose

How to scale images in in html_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:08:591600browse

I put a background image in . When the image is too large, part of it will be displayed. If it is too small, it will be automatically centered. Please tell me how to set it up so that all images will be displayed regardless of whether they are too large or too small. Please give me some advice.


Reply to the discussion (solution)

Baidu can display an image vertically, horizontally and centered

Give the image a specified width.

1. Set a fixed width and height for the image
2. Use js to control the size of the image. If it is smaller than the setting, it will be the original size. If it is larger, it will be adjusted proportionally by js

You are here When writing in span, you need to write the width and height of span display: block; overflow: hidden;

Use jquery. If the width is greater than the maximum value, set the image width to the maximum width value, and then use jquery to implement it. Height = actual height/(actual width/maximum width)

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