使用bootstrap imp fluid时,我是否仍应在图像上指定高度和宽度



我读到总是为图像添加高度和宽度很重要,但我使用的是自举img fluid,它使高度和宽度具有响应性。所以我很好奇其他人对此的看法。

我目前正在做这个:

<img class="img-fluid"
src="../images/jurassic-forest-700w.jpg"
alt="a photo of the walkway at jurassic forest with lush greenery all around and a large brachiosaurus in the distance"
height= 350px;
width= 700px;
>

我需要高度和宽度属性吗?

引导程序4&5:

自Bootstrap 4以来,已经引入了一些关于图像的新类。示例:

<img src="..." class="img-fluid" alt="Responsive image">

img流体的作用是什么?

.img-fluid {
max-width: 100%;
height: auto;
}

用作缩略图的图像为.img-thumbnail

Bootstrap中的图像使用.img fluid进行响应。最大宽度:100%;和高度:auto;应用于图像,使其与父元素一起缩放。

最新更新