Home > Web Front-end > Bootstrap Tutorial > How to center the image in bootstrap

How to center the image in bootstrap

Release: 2019-07-18 17:47:09
Original
4354 people have browsed it

How to center the image in bootstrap

If you are using Bootstrap 3, you may encounter such a problem. You can use .text-center to center-align the text, but the image cannot be centered. To solve this problem The problem is that you may need to do a lot of things, such as adding a div outside the img, and then adjusting the image width, height, etc.

There is a very simple method in Bootstrap 3 to achieve responsive horizontal and vertical center alignment of images. Just add the css class img-responsive center-block to the image to achieve it. Let’s take a look Take a look.

To align images in Bootstrap 3, you can try the following code:

Introduction to Bootstrap v3.0.1. Using the center-block class you can align the figure to the center of the container. The following is an example:

<img src="图片地址" class="img-responsive center-block" />
Copy after login

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

The above is the detailed content of How to center the image in 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