Bootstrap images
In this chapter, we will learn about Bootstrap’s support for images. Bootstrap provides three classes that can apply simple styles to images:
.img-rounded: Add border-radius:6px to Get image rounded corners.
.img-circle: Add border-radius:50% to make the entire image circular.
.img-thumbnail: Add some padding and a gray border.
Please see the following example demonstration:
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap Example - Image</title>
<link href="/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<script src=" /scripts/jquery.min.js"></script>
<script src="/bootstrap/js/bootstrap.min.js"></script>
</head> ;
<body>
<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">
</body>
</html>
<html>
<head>
<title>Bootstrap Example - Image</title>
<link href="/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<script src=" /scripts/jquery.min.js"></script>
<script src="/bootstrap/js/bootstrap.min.js"></script>
</head> ;
<body>
<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">
</body>
</html>
Instance
<!DOCTYPE html> <html> <head> <title>Bootstrap 实例 - 图片</title> <link rel="stylesheet" href="http://apps.bdimg.com/libs/bootstrap/3.3.0/css/bootstrap.min.css"> <script src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script> <script src="http://apps.bdimg.com/libs/bootstrap/3.3.0/js/bootstrap.min.js"></script> </head> <body> <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"> </body> </html>
Run instance»
Click the "Run instance" button to view the online instance
Description | Instance | |
---|---|---|
Add rounded corners to the image (not supported by IE8) | Try it | |
Change the image into a circle (IE8 Not supported) | Try it | |
Thumbnail function | Try it | |
Image responsive (will scale well to parent elements) | Try it out |