Home >Web Front-end >Bootstrap Tutorial >How to set image shape in bootstrap4

How to set image shape in bootstrap4

爱喝马黛茶的安东尼
爱喝马黛茶的安东尼Original
2019-07-17 16:26:252640browse

How to set image shape in bootstrap4

Rounded corner picture

.rounded class allows the picture to display the rounded corner effect:

Example

<img class="rounded lazy"  src="/static/imghwm/default1.png"  data-src="cinqueterre.jpg"    alt="Cinque Terre">

How to set image shape in bootstrap4

Ellipse picture

.rounded-circle class can set an elliptical picture :

Example

<img  class="rounded-circle lazy" src="/static/imghwm/default1.png" data-src="cinqueterre.jpg" alt="How to set image shape in bootstrap4" >

How to set image shape in bootstrap4

Related recommendations: "bootstrap Getting Started Tutorial"

Thumbnail

.img-thumbnail class is used to set picture thumbnails (pictures have borders):

Instance

<img  class="img-thumbnail lazy" src="/static/imghwm/default1.png" data-src="cinqueterre.jpg" alt="How to set image shape in bootstrap4" >

How to set image shape in bootstrap4

Picture alignment

Use the .float-right class to set the right alignment of the picture, and use the .float-left class to set the left alignment of the picture:

Example

<img  class="float-left lazy" src="/static/imghwm/default1.png" data-src="paris.jpg" alt="How to set image shape in bootstrap4" > <img  class="float-right lazy" src="/static/imghwm/default1.png" data-src="cinqueterre.jpg" alt="How to set image shape in bootstrap4" >

How to set image shape in bootstrap4

Responsive images

Images come in a variety of sizes , we need to automatically adapt according to the size of the screen.

We can set up responsive images by adding the .img-fluid class in the <img class="img-fluid lazy" src="/static/imghwm/default1.png" data-src="img_chania.jpg" alt="How to set image shape in bootstrap4" > tag.

.img-fluid 类设置了 max-width: 100%; 、 height: auto; :

Example

<img  class="img-fluid lazy" src="/static/imghwm/default1.png" data-src="img_chania.jpg" alt="How to set image shape in bootstrap4" >

How to set image shape in bootstrap4

The above is the detailed content of How to set image shape in bootstrap4. 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