CSS self-adaptation of images

Source: Internet
Author: User

When CSS is required to scale a picture, you can use the outer container 100% or any percentage,

The inner layer image img tag is not wide, with sass write after breakpoint mixin style is like this:

%;    . left_art{          float: left; text-align:center;          0  the 0 ;         }     } }     

If the width of the breakpoint is larger than the maximum size of the picture, it will not appear centered.

For example, mobile phone horizontal portrait will be very difficult to see.

This time CSS may not be able to do, or need JS to control the width of the outer container, and then margin:0 Auto;

_workscon_section = ($ (window). Width ()->? :($ (window). Width ()-        

The width of the film is 600px, less than 600 when the window width to calculate.

In more than 600 of the time, it should be 600, otherwise it will not be centered.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.