Need to make images responsive in CSS/HTML for custom plugin

I’ve searched the existing questions and found some similar issues, but the suggestions there didn’t solve my problem.

Here is the issue:

We are using the Visual Editor plugin for WordPress. My boss wanted this plugin to be used for a special promotion area in the header – he wants to display images that are clickable or have a button. I wrote some custom CSS so this plugin will do that. The issue, as you know, is you can’t make a link in CSS. So for the background image, I needed a button. However in this particular case there was so much text on the image, a button would not work.

So, I wrote an ID that I could call in HTML. I made a link, called the ID, and then inside the ID I put a text indent that would push the text off the page and the image would be clickable.

The issue here is that for some reason the image would not fully load. It was cutting off height-wise. I had set width: 100%; and height: auto;, but neither of those things worked.

So, I ended up simply inserting the IMG normally, and linking it normally, but now the problem is I need it to be responsive.

I wrote a class called .responsive-image and made the width: 100%; and height: auto; but this still doesn’t work.

Do I need to put the responsive image information elsewhere? Do I need to write some other class? I’m at a loss and have looked at this too long at this point.

You can see this header widget right here –

And if you inspect you can see what I mean about it not being responsive.

Here’s what I’ve written to insert it into the widget:

<div class="days100-background-header-widget"><div class="responsive-image"><a 
<img src="
content/uploads/2017/04/WidgetHeaderAreaMP2017.png" border="0" 
class="responsive-image" alt="Real Food Mini Pledge Program" />

I have the class in there two places. Maybe that’s the issue?

Here’s the CSS for the main header widget class:

display: flex;
align-items: center;
justify-content: center;

Any feedback is really appreciated. Thanks for reading this super long question!!

Read more here: Need to make images responsive in CSS/HTML for custom plugin

Leave a Reply

Your email address will not be published. Required fields are marked *