Envira Gallery Documentation

Documentation, Reference Materials and Tutorials for Envira Gallery

How to use Black & White Filter for Envira Gallery Images

Would you like to style your gallery images to appear black and white until you hover? With a little custom CSS and Envira you can easily achieve this! We’ll help you with the CSS you need to apply a black and white filter over your gallery images with color on hover.

This tutorial is a little more technical then the other docs and will require a basic level of CSS.

Your first step is to create a new gallery or edit an existing one. You can follow along with our documentation for creating your first gallery

Next, on the Configuration tab, select any column count for your Number of Gallery Columns.

First set up the number of gallery columns so that you can style your gallery images

The next step you’ll need to install and activate Envira’s CSS Addon. Navigate to the Addons section and click Install then Activate on the CSS Addon.

Install and activate the CSS addon

Below is the CSS we’ve used in our demo.

You’ll need to change this ID number to match your gallery ID number. You can find this by looking in the sidebar of your gallery edit screen.

For more information on how to find your gallery ID number you can read this article.

You can also just add this CSS to the WordPress Customizer to make this change for all of your Envira Galleries!

To find out more about the WordPress Customizer, please review our article on How to add custom CSS to the WordPress Customizer.

If you’re using the CSS Addon to only change 1 gallery, add your CSS to the Misc tab inside the Custom Gallery CSS box.

Add your CSS to the Misc tab in the Custom Gallery CSS to add a black and white filter to your gallery images
Once you’ve added your CSS just click Publish or Update to save the changes to the gallery.

#envira-gallery-wrap-368044 img {
    filter: grayscale(100%);
    transition: all 0.3s ease-in-out;
}

#envira-gallery-wrap-368044 img:hover {
    filter: grayscale(0);
}
Be sure to update the -368044 with your own gallery ID number

If you’re going to want this change for all galleries, just remove the gallery ID number from the CSS and add your CSS to the Appearance » Customize » Additional CSS and click Publish to save the changes.

Check out the demo

Alternatively, if you wanted to just dull the image down until you hover, you could use this CSS.

#envira-gallery-wrap-368044 img {
    opacity: .5;
    transition: all 0.3s ease-in-out;
}

#envira-gallery-wrap-368044 img:hover {
    opacity: 1;
}

Would you like to have some more fun with Envira and CSS? Why not check out our tutorial on How to Style Image Title and Caption Hover Effects.


Q: Can I do the same for albums too?

A: Absolutely! You’d use exactly the same CSS but just be sure the ID matches the album. If you added your CSS to the WordPress Customizer then it would automatically make this change for all Envira gallery and album images.