Css controls image size, adaptive scaling, and is compatible with IE6 and Firefox

Source: Internet
Author: User

Css controls the image size, adaptive scaling, and is compatible with IE6 and Firefox. For example, we always encounter such problems in Daily website design, and the image size is unknown, the width of the content area of the website we designed is certain. If you set an equal width for all the images, the display will not work. By querying the CSS manual, we know that max-width and max-height can control the image size. If the image width exceeds the content area, the size is limited to the specified width, but the cup always occurs on IE6, A downloading station buddy contacted the Helper's house editor today. He also encountered this problem. He was very concerned about the support of IE6. Originally, the Helper's house had abandoned IE6, however, it is necessary to insert a knife for a friend, and the solution will naturally be available.

The Code is as follows:

Copy to ClipboardReference: [www.bkjia.com] <style type = "text/css">
. Content-width {MARGIN: auto; WIDTH: 600px ;}
. Content-width img {MAX-WIDTH: 100%! Important; HEIGHT: auto! Important; width: expression (this. width> 600? "600px": this. width )! Important ;}
</Style>
</Head>
<Body>

<Div <p> </p>
<P> </p>
</Div>

Tip:

The image width set above is PX, and the sample image is for the customer's house. Please replace the width and image address with your own.

Related Article

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.