Archived topic
Adjust Spacing After Blog Post Images in Articles
8 replies · Started by jal-mj on November 22, 2022
The spacing after blog post images has changed with the last WordPress update. Now it has not any space. I have read in another thread that I can add this CSS:
`figure img {
margin-bottom: 1.5em;
}
It works well but not after youtube videos (I don't know the selector of youtube videos).
Besides it, if you write a description where WordPress says "Add caption" the margin is created before the description, and it should go after it, otherwise it looks strange.
Screenshots:
https://ibb.co/9GxFnX0
https://ibb.co/bNPxvq1
Thank you.
Hi there,
For Youtube video, you can use this selector: figure.wp-block-embed.is-provider-youtube
For the image blocks, try to use this CSS instead:
figure.wp-block-image {
margin-bottom: 2em;
}
Is working for youtube, but not for images. :( I must doing something wrong.
I can still see this CSS on your site:
figure img {
margin-bottom: 1.5em;
}
Can you link me to an article where I can see an image with the caption?
I don't know how you are still seeing this. I have changed that with the code you sent me. I also have deleted cloudflare cache, etc.
You can see the problem in the same page of the video, in the image above.
It seems it works well without figure:
.wp-block-image {
margin-bottom: 2em;
}
Is that possible?
Oh I see, some of your images are optimized by a plugin, it changes the figure to div.
So, yes, this CSS should work for any element that has the .wp-block-image class:
.wp-block-image {
margin-bottom: 2em;
}
Just in case the video one doesn't work either, simply remove the figurefrom the selector, so .wp-block-embed.is-provider-youtube it is.
i was also out of space below the post images but your css solved my problem. thank you so much!
You are welcome Anderson :)