Image widget - add text overlay

Hi there

I have created a sub-menu system using the image widget in my sidebar. See here: http://www.jeanpaulmartinon.nightingalewebsites.co.uk/philosophy/

However I would like the title that currently appears above the image to be display as an overlay on top of the image - ideally centred.

What code do I need to add to archive this?

Many thanks
Sam

Hi Sam,

To achieve that, please add the following CSS under Theme Options > CSS:

.page-id-82 .widget_media_image {
    position: relative;
}
.page-id-82 .widget_media_image .h-widget {
    position: absolute;
    width: 100%;
    top: 50%;
    text-align: center;
    margin-top: -12px;
    z-index: 1;
    background: rgba(191, 190, 190, 0.65);
}

I’ve added .page-id-82 to make sure this custom CSS to work only for the philosophy page.


If you would like to learn CSS, I am sharing few resources that you take a look to get started with CSS and an interesting tool that you can use to speed up the development process.

I recommend you to watch following video that will help you to get started with CSS.

https://www.youtube.com/watch?v=MFR4WXiLzpc

Sometimes it can get a bit difficult to find out the right selector to be able to write the required CSS codes. A handy tool that can help you in this is Google Chrome dev tools. I am sharing the resource that you can refer to get started with dev tools.

https://developers.google.com/web/tools/chrome-devtools/css/

https://developers.google.com/web/tools/chrome-devtools/

https://www.youtube.com/watch?v=tP_kXBJWPhQ&t=200s

Thanks.

Thanks that helps a lot - couple of things:

  1. the only issue is the text/ title is not hyperlinked and the text is the obvious place to click for the link. How would I make the text hyperlinked to the same location as the image.?

  2. is it possible to restrict the background colour you added to just appear behind the text, with a little padding either side?

Thanks for the link to the CSS - I certainly need to learn more!

Best
Sam

Hey Sam,

That is technically possible. However, that would fall beyond the scope of our support since it would require custom development(because we have to change the template structure of widgets).

Thank you for understanding.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.