Jump to content

Adding caption above image in mobile view

Go to solution Solved by tuanphan,

Recommended Posts

Hello all,


I want to add the caption on my gallery as a transparent strip on the bottom of the image when viewing on mobile. I have used the same code as in the desktop view (>640px) but changed the following:

- Height 10%

- Position as flex-end (does seem to end up on the top instead??)





Ideally I want the caption to be at the bottom of each image, and I do not want a hover effect either. It should be there permanently so to speak, anyone know what I am doing wrong here?Currently working from below code:


@media only screen and (max-width:640px) {

.gallery-grid .gallery-caption {
  position: absolute;
  top: 0;
  left: 0;
  background: rgba(0,0,0,0.4); // overlay color 
  height: 10%;
  padding: 0;
  opacity: 0;
  pointer-events: none;
.gallery-grid .gallery-caption-wrapper {
  display: flex;
  align-items: flex-end; // center vertically 
  justify-content: center; // center horizontally
.gallery-grid .gallery-caption-content {
  font-size: 1.2rem !important; // caption font size
  color: white; //caption font color 
  padding: 1vw; // padding around the caption
  text-transform: none !important;
.gallery-grid-item {
  position: relative;
.gallery-grid-item:hover .gallery-caption {
  opacity: 1;
.gallery-caption-grid-simple {
  transition-delay: 0ms;
  max-width: unset;






Link to comment
  • Replies 3
  • Views 1.1k
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

  • Solution

To move caption to top, use this CSS code

@media screen and (max-width:767px) {
figcaption.gallery-caption.gallery-caption-grid-simple {
    bottom: unset !important;
    top: 0 !important;


Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.