Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Bootstrap Images

Bootstrap Images

In this chapter, we will learn about Bootstrap's support for images. Bootstrap provides three classes that apply simple styles to images:

See the following example:

Example

<img src="/wp-content/uploads/2014/06/download.png" class="img-rounded">
<img src="/wp-content/uploads/2014/06/download.png" class="img-circle">
<img src="/wp-content/uploads/2014/06/download.png" class="img-thumbnail">

Try it »

The result is as follows:

class

The following classes can be used with any image.

class Description Example
.img-rounded Add rounded corners to an image (not supported in IE8) Try it
.img-circle Make an image circular (not supported in IE8) Try it
.img-thumbnail Thumbnail Try it
.img-responsive Responsive image (will scale nicely to the parent element) Try it

Responsive Images

By adding the .img-responsive class to the tag, you make the image responsive. The image will scale nicely to its parent element.

The .img-responsive class applies max-width: 100%; and height: auto; styles to the image:

Example

<

img

src=

"cinqueterre.jpg"

class=

"img-responsive"

alt=

"Cinque Terre"

Try it »