Masks
Bootstrap masks
Note: We are transitioning MDB4 to a legacy version and focusing on developing MDB5.
While we'll continue to support for the transition period, we encourage you to migrate to
MDB5. We're offering a huge discount on MDB5 PRO to help with your transition,
enabling you to leverage the full potential of the latest version. You can find more information here.
upgrade with discount
Bootstrap masks alter the visibility of an element by either partially or fully hiding it. Masks are used to make content more visible in the picture.
Pattern
.pattern-8
<div class="view">
<img src="https://mdbootstrap.com/img/Photos/Horizontal/Nature/8-col/img (132).webp" class="img-fluid" alt="Image of ballons flying over canyons with mask pattern one.">
<div class="mask pattern-8 flex-center">
<p class="white-text">.pattern-8</p>
</div>
</div>
Overlay
strong overlay
<div class="view">
<img src="https://mdbootstrap.com/img/Photos/Horizontal/Nature/8-col/img (121).webp" class="img-fluid" alt="sample image">
<div class="mask flex-center rgba-green-strong">
<p class="white-text">strong overlay</p>
</div>
</div>
Patterns
no mask
.pattern-1
.pattern-2
.pattern-3
.pattern-4
.pattern-5
.pattern-6
.pattern-7
.pattern-8
.pattern-9
Usage
Step 1: Create a wrapper containing the class .view
.
<div class="view">
[...]
</div>
Step 2: Set a path to the image. If you want to make your image responsive, remember to add the class .img-fluid
.
<div class="view">
<img src="https://mdbootstrap.com/img/Photos/Others/nature-sm.webp" class="img-fluid" alt="">
</div>
Step 3: Add the class .mask
to cover the image with the pattern.
<div class="view">
<img src="https://mdbootstrap.com/img/Photos/Others/nature-sm.webp" class="img-fluid" alt="">
<div class="mask">
</div>
</div>
Step 4: Choose a pattern class from the examples above.
<div class="view">
<img src="https://mdbootstrap.com/img/Photos/Others/nature-sm.webp" class="img-fluid" alt="">
<div class="mask pattern-1">
</div>
</div>
Step 5: If you want to add some text, you can use the class .flex-center
to center it, and .white-text
to give your text a stronger contrast and make it more visible.
<div class="view">
<img src="https://mdbootstrap.com/img/Photos/Others/nature-sm.webp" class="img-fluid" alt="">
<div class="mask pattern-1 flex-center">
<p class="white-text">.pattern-1</p>
</div>
</div>
Overlays
slight overlay
light overlay
strong overlay
peach gradient overlay
blue gradient overlay
Usage
Instructions and markup are the same as for the patterns. It means that you add an overlay class (.rgba-black-strong
in the example below) to the .mask
.
See the full list of the overlay colors and intensity below
<div class="view">
<img src="https://mdbootstrap.com/img/Photos/Others/nature-sm.webp" class="img-fluid" alt="">
<div class="mask flex-center rgba-black-strong">
<p class="white-text">strong overlay</p>
</div>
</div>
Overlay colors and intensity
Choose one of the classes from the list below to set a desired intensity and color of your mask.
.rgba-blue-light
.rgba-red-light
.rgba-pink-light
.rgba-purple-light
.rgba-indigo-light
.rgba-cyan-light
.rgba-teal-light
.rgba-green-light
.rgba-lime-light
.rgba-yellow-light
.rgba-orange-light
.rgba-brown-light
.rgba-grey-light
.rgba-blue-grey-light
.rgba-black-light
.rgba-stylish-light
.rgba-white-light
.rgba-blue-strong
.rgba-red-strong
.rgba-pink-strong
.rgba-purple-strong
.rgba-indigo-strong
.rgba-cyan-strong
.rgba-teal-strong
.rgba-green-strong
.rgba-lime-strong
.rgba-yellow-strong
.rgba-orange-strong
.rgba-brown-strong
.rgba-grey-strong
.rgba-blue-grey-strong
.rgba-black-strong
.rgba-stylish-strong
.rgba-white-strong
.rgba-blue-slight
.rgba-red-slight
.rgba-pink-slight
.rgba-purple-slight
.rgba-indigo-slight
.rgba-cyan-slight
.rgba-teal-slight
.rgba-green-slight
.rgba-lime-slight
.rgba-yellow-slight
.rgba-orange-slight
.rgba-brown-slight
.rgba-grey-slight
.rgba-blue-grey-slight
.rgba-black-slight
.rgba-stylish-slight
.rgba-white-slight