How to have a Responsive Image & Text Side by Side using Classic Editor
-
Hey everyone,
I’ve been struggling for hours trying to figure out how to display an image side by side with text in WordPress while ensuring it remains responsive. Here’s the issue I’m facing:
I’m using the WordPress classic editor, and whenever I try to lay out an image next to text using basic HTML and CSS, it either breaks on smaller screens or doesn’t adjust properly to different screen sizes. Sometimes not even working at all.
I cannot use the block editor which has this feature build in because it is not support on woocommerce products which is what i am doing. I am trying to make better product descriptions adding pictures.Here is what i tried:
<style>
.textimageblockwrap {
display: flex;
flex-wrap: wrap;
}
.imagebox_desc, .textbox_desc {
flex: 1 1 100%;
box-sizing: border-box;
}
.imagebox_desc {
display: flex;
}
.blockimg {
width: 100%;
height: auto;
object-fit: contain;
}
.textbox_desc {
padding: 1rem;
display: flex;
justify-content: center; /* Center horizontally */
margin: auto; /* Center the box relative to its container */
}
/* Media query for larger screens */
@media (min-width: 600px) {
.imagebox_desc, .textbox_desc {
flex: 1;
}
.textimageblockwrap {
align-items: stretch; /* Ensure items are the same height */
}
.blockimg {
height: 100%;
object-fit: contain; /* Cover the container while preserving aspect ratio */
}
}
</style><div class="textimageblockwrap">
<div class="imagebox_desc">
<img class="blockimg" src="https://www.canor-audio.com/thumbs/460x340-drop-90/42-3985-feedback.jpg" style="max-height: 350px;"/>
</div>
<div class="textbox_desc">
<div>
<h2>Feedback vs Zero feedback</h2>
<p>Canor Virtus M1 enables instant switching between the connection with the feedback or with zero global feedback. This has an influence on the overall performance of the power amplifier which results in a different listening experience.</p>
</div>
</div>
</div>
<div class="textimageblockwrap">
<div class="textbox_desc">
<div>
<h2>Feedback vs Zero feedback</h2>
<p>Canor Virtus M1 enables instant switching between the connection with the feedback or with zero global feedback. This has an influence on the overall performance of the power amplifier which results in a different listening experience.</p>
</div>
</div>
<div class="imagebox_desc">
<img class="blockimg" src="https://www.canor-audio.com/thumbs/460x340-drop-90/42-3985-feedback.jpg" style="max-height: 350px;"/>
</div>
</div>This code in my case just results in this which is not what i want:
When i run the code on an HTML online editor i get the desired results but every solution i find out and develop on HTML doesn’t seem to translate well at all in wordpress. This is the desired result:
I really cant believe that this turned out to be so complex and hard to make… Any help appreciated.
- You must be logged in to reply to this topic.