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.