Made in Europe, buy from Europe.

Black Friday

65% off Annual plans

25% off Lifetime · 10 per week

Ends December 2

Get the deal →

Custom CSS for Modula image titles, captions and hover

Updated 3 min read

Custom CSS lets you change image titles, captions and the hover look in a Modula gallery. CSS is the code that controls how a page looks. Hover means the moment the mouse is over an image.

Many of these changes are settings now. Check the settings first, and use the CSS below for what they don’t cover.

Watch how to check the caption and hover settings, add CSS for one gallery or for all, and see the darken-until-hover code on a page.

Check the settings first

Go to Modula → Galleries and open the gallery. Click Layout and open Captions. You can change these things there:

  • On the image or Under the image sets where the text sits.
  • The title and caption each have a Color, a Size (for computers and phones) and a Boldness.
  • With the text under the image you also get Text alignment, Space under the image and Padding around text.
  • The dark layer over an image on hover is Darken on hover, with its Dim color, on the Motion tab.
The Captions section with title style, Text alignment, Space under the image and Padding around text

Where to add the CSS

If the settings don’t do what you need, add CSS. You can add it for all galleries or for one gallery.

For all galleries

Go to Appearance → Customize → Additional CSS. With a block theme, go to Appearance → Editor → Styles. Then choose Additional CSS from the menu with the three dots.

Use the code below as it is.

In the gallery editor, click CSS in the left rail.

Then replace .modula at the start of each rule with the gallery’s own selector, #modula-12. A selector is the part of the code that says what to change. Here, 12 is the gallery ID.

The Copy button next to Custom CSS copies the selector of your gallery.

Custom CSS examples for titles, captions and hover

In the code below, the title is .modula-title and the caption is .modula-description, whether they sit on the image or under it.

You can read more about adding CSS in How to add custom CSS to Modula galleries.

Add padding around the caption

Padding is the empty space around the text. This code adds it to the caption.

CSS
.modula .modula-item .modula-description {
  padding: 25px !important;
}

Raise or lower 25px for more or less space.

Change the letter spacing of the caption

Letter spacing is the space between the letters.

CSS
.modula .modula-item .modula-description {
  letter-spacing: 0 !important;
}

Replace 0 with the spacing you want, for example 1px.

Center or align the title and caption

This code centers the title and the caption.

CSS
.modula .modula-item .modula-title,
.modula .modula-item .modula-description {
  text-align: center !important;
}

Use left or right instead of center to align the text to one side. For text under the image, use Text alignment instead.

Add a background behind the title

This code puts a dark background behind the title.

CSS
.modula .modula-item .modula-title {
  background-color: rgba(0, 0, 0, 0.5);
}

The last number is how see-through the background is, from 0 (invisible) to 1 (solid).

Change the line height of the title

Line height is the space between the lines of the title. This code sets it.

CSS
.modula .modula-item .modula-title {
  line-height: 1.2 !important;
}

Darken the images until the mouse is over them

This code keeps the images dark until the mouse is over them.

CSS
.modula .modula-item img.pic {
  filter: brightness(60%);
}
.modula .modula-item:hover img.pic {
  filter: none;
}

Lower 60% for darker images. Don’t combine this code with a hover look that turns images black and white. Both use the same CSS property.

Stop the images from darkening on hover

In the gallery editor, open Motion and switch off Darken on hover.

Was this page helpful?
0 0

Still stuck?

Can’t find the answer?

Write to us with what you tried and what you expected to happen, and we’ll help you sort it out.