In this chapter, we will learn Bootstrap support for images. Bootstrap provides three classes that can apply a simple style to a picture:
. img-rounded: Add a border-radius:6px to get a picture fillet.
. img-circle: Add border-radius:500px to turn the entire picture into a circle.
. Img-thumbnail: Add some padding (padding) and a gray border.
<! DOCTYPE html>
<link rel= "stylesheet" href= "/stylesheets/bootstrap.min.css" >
<body>
</body>
Responsive Picture
In Bootstrap version 3, by adding a. Img-responsive class to a picture, you can make the picture support a responsive layout . Its essence is to set the max-width:100% for the picture , Height:auto; and Display:block; property, which allows the picture to be scaled better in its parent element.
If you need to center the picture horizontally using the. Img-responsive class, use the . Center-block class, and do not use. Text-center.
SVG Images and IE 8-10
In Internet Explorer 8-10 , SVG images that are set to. img-responsive are not symmetrical in size. In order to solve this problem, add width:100% \9in the wrong place; Can. Bootstrap does not automatically set this property for all image elements because it causes other image formats to become garbled.
Picture shape
You can make a picture appear in a different shape by adding the following appropriate class for the element.
Cross-browser compatibility
Keep in mind that Internet Explorer 8 does not support fillet properties in CSS3.
| class |
Description |
| . img-rounded |
Add rounded corners to pictures (IE8 not supported) |
| . img-circle |
Turn a picture into a circle (IE8 not supported) |
| . img-thumbnail |
Thumbnail function |
| . img-responsive |
Picture response (will well extend to parent element) |
Bootstrap Precautions (vii) Photos