1
0
Fork 0
mirror of https://github.com/twbs/bootstrap.git synced 2022-11-09 12:25:43 -05:00

Add utility classes for opacity (#33781)

* Add responsive utility classes for opacity

- fix for #33483

* remove responsive opacity utils as it has impact on bootstrap.css bundle size

* Update opacity.md

* Update site/content/docs/5.0/utilities/opacity.md

Co-authored-by: Mark Otto <otto@github.com>

* Update site/content/docs/5.0/utilities/opacity.md

Co-authored-by: Mark Otto <otto@github.com>

Co-authored-by: Harish <halodoc@ip-192-168-1-101.ap-southeast-1.compute.internal>
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
Co-authored-by: Mark Otto <otto@github.com>
Co-authored-by: Mark Otto <markd.otto@gmail.com>
Co-authored-by: alpadev <2838324+alpadev@users.noreply.github.com>
This commit is contained in:
harishhalodoc 2021-06-23 07:50:01 +05:30 committed by GitHub
parent 2d8da8bcb0
commit a816615efa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 44 additions and 0 deletions

View file

@ -24,6 +24,19 @@ $utilities: map-merge(
) )
), ),
// scss-docs-end utils-float // scss-docs-end utils-float
// Opacity utilities
// scss-docs-start utils-opacity
"opacity": (
property: opacity,
values: (
0: 0,
25: .25,
50: .5,
75: .75,
100: 1,
)
),
// scss-docs-end utils-opacity
// scss-docs-start utils-overflow // scss-docs-start utils-overflow
"overflow": ( "overflow": (
property: overflow, property: overflow,

View file

@ -0,0 +1,30 @@
---
layout: docs
title: Opacity
description: Control the opacity of elements.
group: utilities
---
The `opacity` property sets the opacity level for an element. The opacity level describes the transparency level, where `1` is not transparent at all, `.5` is 50% visible, and `0` is completely transparent.
Set the `opacity` of an element using `.opacity-{value}` utilities.
<div class="bd-example d-sm-flex">
<div class="opacity-100 p-3 m-2 bg-primary text-light fw-bold rounded">100%</div>
<div class="opacity-75 p-3 m-2 bg-primary text-light fw-bold rounded">75%</div>
<div class="opacity-50 p-3 m-2 bg-primary text-light fw-bold rounded">50%</div>
<div class="opacity-25 p-3 m-2 bg-primary text-light fw-bold rounded">25%</div>
</div>
```html
<div class="opacity-100">...</div>
<div class="opacity-75">...</div>
<div class="opacity-50">...</div>
<div class="opacity-25">...</div>
```
### Utilities API
Opacity utilities are declared in our utilities API in `scss/_utilities.scss`. [Learn how to use the utilities API.]({{< docsref "/utilities/api#using-the-api" >}})
{{< scss-docs name="utils-opacity" file="scss/_utilities.scss" >}}

View file

@ -101,6 +101,7 @@
- title: Flex - title: Flex
- title: Float - title: Float
- title: Interactions - title: Interactions
- title: Opacity
- title: Overflow - title: Overflow
- title: Position - title: Position
- title: Shadows - title: Shadows