如果你想OVERRIDE Bootstrap,你需要做你正在做的事情:将
style="height:200px; width:200px;"
添加到你的<img>
元素。
否则,对于 Bootstrap 的“默认”图像样式,请查看此处:
https://getbootstrap.com/docs/5.0/content/images/
响应式图片
Bootstrap 中的图像通过 .img-fluid 进行响应。这 应用最大宽度:100%;和高度:自动;到图像,以便它 随父元素缩放。
图像缩略图
除了我们的边界半径实用程序之外,您还可以使用 .img-thumbnail 为图像提供圆形 1px 边框外观。
对齐图像
将图像与辅助浮动类或文本对齐类对齐。 块级图像可以使用 .mx-auto margin 实用程序居中 类。
Sass 变量
变量可用于图像缩略图。
$thumbnail-padding: .25rem; $thumbnail-bg: $body-bg; $thumbnail-border-width: $border-width; $thumbnail-border-color: $gray-300; $thumbnail-border-radius: $border-radius; $thumbnail-box-shadow: $box-shadow-sm;