Opacity
Opacity
Canvas provides both Bootstrap style opacity utilities and its own fine grained opacity scale, plus an opacity transition helper.
Bootstrap opacity
| Class | Opacity |
|---|---|
.opacity-0 |
0 |
.opacity-25 |
0.25 |
.opacity-50 |
0.5 |
.opacity-75 |
0.75 |
.opacity-100 |
1 |
Canvas fine scale
Canvas adds a .op-* scale in 0.1 steps, handy for image overlays and hover reveals:
| Class | Opacity |
|---|---|
.op-0 |
0 |
.op-01 |
0.1 |
.op-02 |
0.2 |
.op-03 |
0.3 |
.op-04 |
0.4 |
.op-05 |
0.5 |
.op-06 |
0.6 |
.op-07 |
0.7 |
.op-08 |
0.8 |
.op-09 |
0.9 |
.op-1 |
1 |
Hover opacity
Every step has a hover twin that changes opacity on hover: .h-op-0, .h-op-01 ... .h-op-1.
Smooth transition
Add .op-ts to animate opacity changes (it sets transition: opacity). Combine with a hover class for a fade effect:
<div class="op-06 h-op-1 op-ts">
Sits at 60% opacity, fades to full on hover.
</div>Usage
Dim a background image so overlaid text stays legible:
<div class="position-relative">
<img src="photo.jpg" class="op-05" alt="">
<div class="position-absolute top-50 start-50 translate-middle">
Readable caption
</div>
</div>Classes
| Class | Description |
|---|---|
.op-* | Sets the
.h-op-{value} - Sets an Opacity Value on the Element on Hover |
.op-ts | Applies Opacity CSS3 Transitions on the Element Example: [ch_pre]
...
[/ch_pre] |
Was this page helpful?
