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

How to scale images in in html_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:08:59
Original
1640 people have browsed it

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)

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template