- This topic has 10 replies, 5 voices, and was last updated 2 years, 8 months ago by Leo.
-
AuthorPosts
-
March 24, 2020 at 3:25 am #1208164Oisin
Hi there,
I used Generate Blocks to rebuild my homepage but I’m now seeing a small bit of space at the bottom of my image. I’ve looked at it in DevTools but can’t figure out where it’s coming from. Any help much appreciated.
Oisin.
March 24, 2020 at 4:57 am #1208234DavidStaffCustomer SupportHi there,
Its the default image alignment, add this CSS which will be included in the GenerateBlocks release candidate:
.gb-inside-container .wp-block-image img { vertical-align: bottom; }
September 10, 2020 at 11:31 am #1438455OisinHi David,
For some reason this no longer works. Have you any idea why that might be?
Thanks,
Oisín.
September 10, 2020 at 6:24 pm #1438729ElvinStaffCustomer SupportHi,
Alternative to CSS code, you can try setting the vertical alignment of the right column to Bottom: – https://docs.generateblocks.com/article/grid-overview/#editing-our-grid-block
I’ve checked your image block and seems to be set to align right. By default, Gutenberg’s alignright class also add margin top and bottom which can also cause the gap you see.
To remove this, you can either remove the image block’s alignment setting or set it to align center.
or keep the settings and add this css code.
.wp-block-image .alignright { margin: .5em 0 0 1em; }
Let us know if this works for you.
September 10, 2020 at 6:44 pm #1438736ElvinStaffCustomer Supportor keep the settings and add this css code.
.wp-block-image .alignright { margin: .5em 0 0 1em; }
Note: this will apply all wp-block-image w/ alignright class. If that isn’t preferred, you may want to add Additional CSS class(es) on image block’s advanced settings and use for css styling.
It may look something like this:
and CSS code:
.no-margin-bottom { margin-bottom: 0 !important; }
September 11, 2020 at 1:30 am #1438936OisinHi Elvin,
I tried:
.no-margin-bottom { margin-bottom: 0 !important; }
but it didn’t work for some reason? I definitely need the image right align so just need it to sit neatly on the line and everything will be fine.
Any other reason why this is not working?
Thanks,
Oisín
September 11, 2020 at 5:17 am #1439180DavidStaffCustomer SupportFor Elvins CSS do this:
.no-margin-bottom figure { margin-bottom: 0 !important; }
September 11, 2020 at 1:39 pm #1439859OisinThat worked perfect, thanks David. Why figure instead of img?
September 11, 2020 at 2:54 pm #1439918ElvinStaffCustomer SupportThanks David! 🙂
That worked perfect, thanks David. Why figure instead of img?
Because
<img>
is just a child of the<figure>
tag, which is the one who has the unwanted margin that’s causing the gap.:)It’s basically structured this way in the DOM:
div.no-margin-bottom
(css class we added) >figure.alignright
(causing the gap) >img
(the actual image)Good to know that it works for you now. Cheers. 🙂
August 23, 2021 at 11:25 am #1905805roadlinkI have added this code to additional css.
.no-margin-bottom figure { margin-bottom: 0 !important; }
then added Additional CSS class(es) on image block’s advanced settings and use for css styling.
As no-margin-bottom it didn’t work.
Also tried to add no-margin-bottom figure still no.August 23, 2021 at 11:27 am #1905808LeoStaffCustomer SupportPlease stick with your own topic here:
https://generatepress.com/forums/topic/remove-gap-between-2-images-added-by-gutenberg/#post-1905806Thanks!
-
AuthorPosts
- The topic ‘How to remove unwanted spacing under image’ is closed to new replies.