How To Place A Button And Or Text Over An Image In Divi Tutorial by Pee Aye Creative

How To Place A Button And/Or Text Over An Image In Divi

In this tutorial I will show you how to add a button module or text module positioned centered over an image module in Divi.

Join subscribers on our YouTube channel and enjoy other Divi video tutorials!

The Process

We have three different things we are showing you today.

  • Text over an image
  • Button over an image
  • Text AND a button over an image

Each of these have the same steps, so just choose whether you want a button, text, or both and proceed with that one. The steps are pretty simple. Add the modules to your layout, add a custom CSS class to that column, adjust the design settings, and add the CSS snippet. 

If you are using our free Divi child theme, place this snippet into the style.css file. Otherwise, place this in your Divi>Theme Options>Custom CSS code box. If you need help, check out our complete guide on Where To Add Custom Code In Divi.

Add A Divi Button Module Centered Over An Image Module

1. Add An Image Module And A Button Module In The Same Column

Go ahead and add an Image module to a column. Then below it also add a Button module. Here is what you should have so far:

add a Divi image module and button module to same column

2. Design The Modules

Of course you should take some time to adjust the Divi Builder design settings for both modules. Remember, this is the great thing about this method. You can use all the normal design settings for both modules!

3. Add A CSS Class To The Column

Now go to the Row Settings>Column Settings>Advanced tab>CSS ID & Classes toggle and add “pa-button-over-image” to the CSS Class input field. This class is used in the CSS snippet below to target this particular column. So you can add this custom class to any column that you want to have a button over an image.

add a custom CSS class for putting a Divi Button module over an image

4. Add The CSS Snippet To Your Website

Now it’s time to add the CSS snippet that does all the work for us.

/*move and position the Button module over the center of the Image module*/

.pa-button-over-image > .et_pb_button_module_wrapper {
	position: absolute;
	top: 45%;
	left: 50%;
	transform: translate(-50%, -45%);
	z-index: 10;
	transition: opacity 0.3s ease-in-out;
	/*opacity: 0; remove comment for hover reveal effect*/
}


/*add an optional overlay over the image*/

.pa-button-over-image > .et_pb_image .et_pb_image_wrap:before {
	content: "";
	position: absolute;
	width: 100%;
	height: 100%;
	background-color: #000000;
	z-index: 9;
	transition: opacity 0.3s ease-in-out;
	opacity: 0.3; /*make this 0 for hover reveal effect*/
}


/*show button on image hover*/

.pa-button-over-image:hover > .et_pb_button_module_wrapper {
	/*opacity: 1; remove comment for hover reveal effect*/
}


/*show overlay on image hover*/

.pa-button-over-image:hover > .et_pb_image .et_pb_image_wrap:before {
	/*opacity: 0.3; remove comment for hover reveal effect*/
}

5. Add Optional Hover Reveal Effect

In the snippet above I have added some extra code that will allow you to show the button when you hover over the image. You just need to make a few easy edits to make that happen. Everything is clearly noted in the code with instructions. If you need any help please watch the video to see what I mean.

6. View Results And Make Any Adjustments

Here is the result that I created in the video:

add a Divi button module over an image module
add button on hover over image in Divi min

You may need to adjust the top: 44%; value. This will depend on some factors like how tall your button and image are and this is just a minor adjustment you may need to make on yours.

Add A Divi Text Module Centered Over An Image Module

1. Add An Image Module And A Text Module In The Same Column

Go ahead and add an Image module to a column. Then below it also add a Text module. Here is what you should have so far:

add a Divi image module and text module to same column

2. Design The Modules

Of course you should take some time to adjust the Divi Builder design settings for both modules. Remember, this is the great thing about this method. You can use all the normal design settings for both modules!

3. Add A CSS Class To The Column

Now go to the Row Settings>Column Settings>Advanced tab>CSS ID & Classes toggle and add “pa-text-over-image” to the CSS Class input field. This class is used in the CSS snippet below to target this particular column. So you can add this custom class to any column that you want to have a text over an image.

add a custom CSS class for putting a Divi Text module over an image

4. Add The CSS Snippet To Your Website

Now it’s time to add the CSS snippet that does all the work for us.

/*move and position the Text module over the center of the Image module*/

.pa-text-over-image > .et_pb_text {
	position: absolute;
	top: 45%;
	left: 50%;
	transform: translate(-50%, -45%);
	z-index: 10;
	width: 100%;
	transition: opacity 0.3s ease-in-out;
	/*opacity: 0; remove comment for hover reveal effect*/
}


/*add an optional overlay over the image*/

.pa-text-over-image > .et_pb_image .et_pb_image_wrap:before {
	content: "";
	position: absolute;
	width: 100%;
	height: 100%;
	background-color: #000;
	z-index: 9;
	transition: opacity 0.3s ease-in-out;
	opacity: 0.3; /*make this 0 for hover reveal effect*/
}


/*show overlay on image hover*/

.pa-text-over-image:hover > .et_pb_text {
	/*opacity: 1; remove comment for hover reveal effect*/
}


/*show text on image hover*/

.pa-text-over-image:hover > .et_pb_image .et_pb_image_wrap:before {
	/*opacity: 0.5; remove comment for hover reveal effect*/
}

5. Add Optional Hover Reveal Effect

In the snippet above I have added some extra code that will allow you to show the button when you hover over the image. You just need to make a few easy edits to make that happen. Everything is clearly noted in the code with instructions. If you need any help please watch the video to see what I mean.

6. View Results And Make Any Adjustments

Here is the result that I created in the video. I center aligned the text, set the text color to white, and added some left and right padding.

add a Divi Text module over an image module
add text on hover over image in Divi min

You may need to adjust the top: 44%; value. This will depend on some factors like how tall your button and image are and this is just a minor adjustment you may need to make on yours.

Add A Divi Call-To-Action Module Centered Over An Image Module

1. Add An Image Module And A Call-To-Action Module In The Same Column

Go ahead and add an Image module to a column. Then below it also add a Call-To-Action module. Here is what you should have so far:

add a Divi image module and call to action module to same column

2. Design The Modules

Of course you should take some time to adjust the Divi Builder design settings for both modules. Remember, this is the great thing about this method. You can use all the normal design settings for both modules!

3. Add A CSS Class To The Column

Now go to the Row Settings>Column Settings>Advanced tab>CSS ID & Classes toggle and add “pa-text-button-over-image” to the CSS Class input field. This class is used in the CSS snippet below to target this particular column. So you can add this custom class to any column that you want to have text and a button over an image.

add a custom CSS class for putting a Divi Call To Action module over an image

4. Add The CSS Snippet To Your Website

Now it’s time to add the CSS snippet that does all the work for us.

/*move and position the Call-To-Action module over the center of the Image module*/

.pa-text-button-over-image > .et_pb_promo {
	position: absolute;
	top: 44%;
	left: 50%;
	transform: translate(-50%, -50%);
	z-index: 10;
	width: 100%;
	transition: opacity 0.3s ease-in-out;
	/*opacity: 0; remove comment for hover reveal effect*/
}


/*add an optional overlay over the image*/

.pa-text-button-over-image > .et_pb_image .et_pb_image_wrap:before {
	content: "";
	position: absolute;
	width: 100%;
	height: 100%;
	background-color: #000;
	z-index: 9;
	transition: opacity 0.3s ease-in-out;
	opacity: 0.5; /*make this 0 for hover reveal effect*/
}


/*show overlay on image hover*/

.pa-text-button-over-image:hover > .et_pb_promo {
	/*opacity: 1; remove comment for hover reveal effect*/
}


/*show call-to-action on image hover*/

.pa-text-button-over-image:hover > .et_pb_image .et_pb_image_wrap:before {
	/*opacity: 0.5; remove comment for hover reveal effect*/
}

5. Add Optional Hover Reveal Effect

In the snippet above I have added some extra code that will allow you to show the button when you hover over the image. You just need to make a few easy edits to make that happen. Everything is clearly noted in the code with instructions. If you need any help please watch the video to see what I mean.

6. View Results And Make Any Adjustments

Here is the result that I created in the video. I center aligned the text, set the text color to white, removed the ugly blue background, added some left and right padding, and styled the button. Note that you will need to add a link to the button for it to show up!

add a Divi call to action module over an image module
add call to action on hover over image in Divi min

You may need to adjust the top: 44%; value. This will depend on some factors like how tall your button and image are and this is just a minor adjustment you may need to make on yours.

19

Last updated Aug 31, 2021 @ 9:29 am

Subscribe

Each month we send out a roundup email newsletter with the latest tutorials, product updates, helpful resources, and any other industry or personal news. Occasionally we send an extra separate email here and there if we just can’t wait! So that’s what you will get if you subscribe, and you can always unsubscribe at any time if you just can’t take it anymore :)

Please share this post!

Nelson Lee Miller (aka The Divi Teacher)

Nelson is the owner of Pee-Aye Creative in the beautiful state of Pennsylvania. He loves helping small businesses, exploring outdoors, building websites with Divi, and teaching others.

Leave A Response!

By commenting you agree to our Blog & YouTube Comments Policy

29 Comments

  1. Dayna

    Hi there, How do you make it work if there are 2 images in a column and you want different text overtop each image?

    Reply
    • Hemant Gaba

      Hi Dayna,

      The recommendation here would be to use two different rows one over the other and place the image text pair in two different columns for the perfect results. 🙂

      Reply
  2. Lis

    Loved this tutorial! I tried to use it to add A Divi Text Module Centered Over An Image Module.

    However when using the CCS snippet provided, I keep getting the messages ‘expected RBRACE’ at around line 3, and ‘unexpected token’ all the way at the bottom.

    I’m not sure what the issue is and/or whether I should manually adjust any opening and closing braces in the snippet text provided?

    Yes you guessed: newby…

    Reply
    • Hemant Gaba

      Hi Lis,

      I am afraid that I am not able to replicate the issue on my end. Please make sure to copy the code accurately and place it in Theme Options > Custom CSS Panel.
      If there is no issue in copy and pasting then the possibility is that the existing CSS code has some issues and that is the reason for the error getting displayed so please make sure that the other CSS Code is not causing any conflict.

      Let me know how it goes. 🙂

      Reply
    • Jan

      Hi Lis,

      I had the same errors.

      I did go to the dashboard – Divi – Theme Options – scrolled down to the end – and placed the code in the black rectangle – save changes.

      Reply
      • Hemant Gaba

        Hi Jan,

        This is really strange as on my end it works perfectly fine. Could you please create a small video using loom or anything else and provide me the link so that I can exactly see where things are going wrong for you?

  3. Tess

    YOU ARE A GOD!!
    Thank you, I’ve tried a few Divi tutorials, none have worked but this one worked instantly and super easy to configure to meet specific requirements!
    Thanks a bunch!

    Reply
  4. Jon

    How do you change the text type (need to know what to insert, I am a rookie) for the button and how do you give the color of the button some opacity of around 50%?

    Reply
    • Hemant Gaba

      Hey Job, when you hover over the button while editing then you will spot few icons and from them click on the settings icon. After that you will see the content tab where you can update the text of the button. To provide color to the button you need to go to the design tab within the button module settings and enable use custom styles for button and after that click plus sign on the background color settings and slide down the right most bar to decrease the opacity.

      Reply
  5. James Worthington

    Great work! I appreciate all your time in sharing all your tips and tricks. You are a Master!!!

    Reply
  6. Alexander

    Very well detailed on your video and wording on this page. I appreciate you sharing this knowledge. Very helpful.

    I was hoping to know if you by any chance have a video on how to place two buttons on the same image? One button to the left of the image and the second button to the right of the image. If you don’t have a video, maybe a quick tip to know how to do it.

    I tried adding another button at the same area and changing the class name by just adding the word “right” to it.

    Reply
    • Hemant Gaba

      Hi Alexander,

      In this guide, you saw how we can place Text Module over an image. Now in the text module you can place the anchor tags inside the div like this:


      Now at the place of #, you can place the link you want people to get directed to on click. You can grab the classes given to the elements and style it using CSS and you will have two buttons on the image.

      Reply
  7. Igor Pont

    I truly love this little gem – like I love all those other gems – that’s why I bought the lifetime all-access! Great work Nelson and Tasha! Keep it up!

    The only thing is that I have trouble getting it to work flawlessly on all screen sizes. You can see the result here: https://www.copernicus-dronten.nl/ and on smaller desktops the text slides over each other to become unreadable. On mobile it looked so crooked I replaced it entirely with a fixed image, but I’d like for it to work on desktops. Any tips?

    Thanks
    Igor Pont

    Reply
    • Hemant Gaba

      Hey Igor,

      You took a right step in changing the whole element with an image for the screens below 980px. For the desktop, the issue is happening because the top value that both the before and after pseudo-elements have are in percentages so it will adjust as the screen size changes but since the font-size is fixed that is in px so it is not adjusting accordingly and which is leading to an overlapping issue.

      To fix this set the top value in :after code to around 295px and set the top value in :before to 200px and the problem will be solved. You can change the values as well as per your liking.

      Let me know how it goes. 🙂

      Reply
  8. Tyrel

    This is a great tutorial, very simple to follow, thank you.

    For some reason my text modual is not showing up above the image but seems to be getting placed by the image module, do you have any idea how I can fix this?

    The error is located on the home page of our site, the Character images at the bottom are the ones with the CSS code added.
    http://www.quirkyresource.com/

    Reply
    • Hemant Gaba

      Hey Tyrel,

      I have checked the website and I am not able to find any issue under the character heading that you have mentioned. Could you please check the website in incognito mode or in a different browser and see if that helps?

      Let me know how it goes.

      Reply
      • Tyrel

        Thanks for looking, It turned out when applying the CSS code that the text appeared quite far up the page. I thought it disappeared all together. When I adjusted some of the margin percentage it came back to center image. Thank you for the help.

      • Hemant Gaba

        Hey Tyrel,

        I am glad that the issue is resolved now. Let me know if you need any further assistance.

  9. Amaia

    hi I think i’ve followed all the steps but my text is where it was before… i have ‘pa-text-over-image’ in the 2 column css classes in row settings then I have the copied blurb for text over image pasted in the child theme in css class… did i miss something?

    i feel like i’m spending forever and getting nowhere! thanks, Amaia

    Reply
    • Amaia

      scrap that – just went out and back in and it has the text on the images! thanks!

      Reply
    • Hemant Gaba

      Hey Amaia,

      Could you please share the URL of the page in order for me to investigate the issue?

      Reply
  10. Aurelien

    Very interesting tutorial.

    Do you think it’s possible to do this for the portfolio module (replace the icon by a button) “see the project”?

    Thank you for your tutorials, always of great quality!
    Aurélien.

    Reply
  11. GB

    Is there a way to also add a .svg? I’ve already uploaded them, but can’t figure out how to include them. I want to put them on top of the text.

    Reply
  12. Trudy Barker

    I really appreciate your tips here, thanks so much for helping all us Divi users!

    Reply

Submit a Comment

Your email address will not be published.

Recent Posts

Pin It on Pinterest

0

Your Cart