久久精品水蜜桃av综合天堂,久久精品丝袜高跟鞋,精品国产肉丝袜久久,国产一区二区三区色噜噜,黑人video粗暴亚裔

Bootstrap圖片

2023-11-14 187

Bootstrap 框架為圖片提供了一些預(yù)設(shè)的樣式類,以幫助開發(fā)者輕松地對圖片排版。本教程展示了如何讓圖片支持響應(yīng)式行為(這樣它們就不會超出父元素的范圍)以及如何通過類(class)添加些許樣式。

一、響應(yīng)式圖片

通過 Bootstrap 所提供的 .img-fluid 類讓圖片支持響應(yīng)式布局。其原理是將 max-width: 100%; 和 height: auto; 賦予圖片,以便隨父元素一起縮放。

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

Bootstrap圖片

二、SVG圖片和IE瀏覽器

在 Internet Explorer 10 和 11 中,添加 .img-fluid 類的 SVG 圖片的尺寸比例是錯(cuò)誤的。要解決此問題,請?jiān)诒匾獣r(shí)添加 width: 100%; 或 .w-100。此修復(fù)方法無法正確調(diào)整其它圖片格式的尺寸,因此 Bootstrap 不會自動(dòng)開啟此方法。

三、圖片縮略圖

除了 Bootstrap 提供的 border-radius utilities 外,還可以使用 .img-thumbnail 使圖片的外觀具有 1px 寬度的圓形邊框。

<img src="..." class="img-thumbnail" alt="...">

Bootstrap圖片

四、對齊圖片

通過使用 helper float classes 或 text alignment classes 將圖片對齊。塊級(block-level)圖片可以使用 the .mx-auto margin utility class 居中對齊。

<img src="..." class="rounded float-left" alt="...">
<img src="..." class="rounded float-right" alt="...">

Bootstrap圖片

<img src="..." class="rounded mx-auto d-block" alt="...">

Bootstrap圖片

<div class="text-center">
<img src="..." class="rounded" alt="...">
</div>

Bootstrap圖片

五、<picture>

如果使用 <picture> 元素為某個(gè) <img> 指定多個(gè) <source> 元素的話,請確保將 .img-* 類添加到 <img> 元素而不是 <picture> 元素上。

<picture>
<source srcset="..." type="image/svg+xml">
<img src="..." class="img-fluid img-thumbnail" alt="...">
</picture>
  • 廣告合作

  • QQ群號:4114653

溫馨提示:
1、本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享網(wǎng)絡(luò)內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時(shí)間刪除。郵箱:2942802716#qq.com(#改為@)。 2、本站原創(chuàng)內(nèi)容未經(jīng)允許不得轉(zhuǎn)裁,轉(zhuǎn)載請注明出處“站長百科”和原文地址。
Bootstrap圖片
上一篇: Bootstrap代碼
Bootstrap圖片
下一篇: Bootstrap表格