. If it is in the content page, use js directly to each page. Just add attributes to an img."/> . If it is in the content page, use js directly to each page. Just add attributes to an img.">

Home >Web Front-end >Bootstrap Tutorial >How to make images adaptive with bootstrap

How to make images adaptive with bootstrap

尚
Original
2019-07-11 15:38:484380browse

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!

Statement:
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