CSS Remove image img frame and how to prevent pictures from bursting div

Source: Internet
Author: User

We are often confronted with the following situations:

1, IMG Image has a border, especially after the link of the picture with a border

2, pictures beyond the bursting div

View CSS Set picture width height

Below we solve these 2 problems through CSS.

1, IMG Image has a border, especially after the link of the picture with a border

Picture with border

Based on the above diagram, we link to the picture, and the resulting picture has a border,

Workaround:

We just need to initialize the IMG tag css

img{padding:0 border:0} Add this CSS to eliminate borders

CSS Remove picture border effect

2, pictures beyond the bursting div

We often encounter because a picture is too wide and burst the width we set.

Solutions

Use CSS control to change the object img tag width, if the object is. Yangshi set width of 500px, then we just set. Yangshi img{max-width:500px; But in the IE6 max-width is ineffective, then we have the best solution, in the upload picture when more set width, so that the picture itself is less than the width of the local set width can, so feel very troublesome, but many large sites are such a solution, one can avoid bursting set width, Two can reduce the size of the picture so that the browser open the Web page faster.

Summarize:

1, a Web page will inevitably have pictures, then we need to initialize the IMG tag is: img{padding:0; border:0;

2, to avoid the picture too wide burst Web page, we suggest that when uploading pictures to cut the picture than the set width is small, but also to the object to add Overflow:hidden properties, that is, hidden beyond the content including pictures.

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.