陰影
使用 `box-shadow` 實用程式將陰影新增或移除至元素。
在此頁面
範例
雖然 Bootstrap 中元件上的陰影預設為停用,且可透過 $enable-shadows
啟用,您也可以使用我們的 box-shadow
實用程式類別快速新增或移除陰影。包含對 .shadow-none
和三種預設大小(具有對應變數以進行比對)的支援。
無陰影
小陰影
一般陰影
較大陰影
<div class="shadow-none p-3 mb-5 bg-body-tertiary rounded">No shadow</div>
<div class="shadow-sm p-3 mb-5 bg-body-tertiary rounded">Small shadow</div>
<div class="shadow p-3 mb-5 bg-body-tertiary rounded">Regular shadow</div>
<div class="shadow-lg p-3 mb-5 bg-body-tertiary rounded">Larger shadow</div>
CSS
Sass 變數
$box-shadow: 0 .5rem 1rem rgba($black, .15);
$box-shadow-sm: 0 .125rem .25rem rgba($black, .075);
$box-shadow-lg: 0 1rem 3rem rgba($black, .175);
$box-shadow-inset: inset 0 1px 2px rgba($black, .075);
Sass 實用程式 API
陰影實用程式在我們的實用程式 API 中宣告於 scss/_utilities.scss
。 瞭解如何使用實用程式 API。
"shadow": (
property: box-shadow,
class: shadow,
values: (
null: var(--#{$prefix}box-shadow),
sm: var(--#{$prefix}box-shadow-sm),
lg: var(--#{$prefix}box-shadow-lg),
none: none,
)
),