How to make images adaptive with bootstrap

Release: 2019-07-12 08:59:14
Original
4325 people have browsed it

How to make images adaptive with bootstrap

bootstrap method to make images adaptive:

1. If you are inserting an image on the page, just add class="img-responsive"

2. If it is in the content page, just use js to add attributes to each img. .

$(".setting img").addClass("img-responsive center-block"); //center-block The picture is horizontally centered

In Bootstrap version 3, pass as the picture Adding the .img-responsive class allows images to support responsive layout. The essence is to set the max-width: 100%;, height: auto; and display: block; attributes for the image, so that the image can be better scaled in its parent element.

For more technical articles related to Bootstrap, please visit the Bootstrap Tutorial column to learn!

The above is the detailed content of How to make images adaptive with bootstrap. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template