Archived topic
Remove/disable last child footer widget margin bottom
5 replies · Started by Fabio on August 16, 2021
Hi all !
with the news WorpdPress 5.8 we can now use generate blocks on widgets, super cool !
but my problem is that if i put in a widget position three headings blocks, i can't manage their bottom margin with gp blocks options, cause at this moment the code is creating three different aside blocks with inside the heading, and there is a css instruction that set always margin bottom 0
here an example of code:
so my problem is that every time i use an heading block, it is the only and the last and uses this css from main.min.css
.footer-widgets .widget :last-child, .sidebar .widget :last-child {
margin-bottom: 0;
}
yes i can do not use gp blocks, and a single html block, or set a custom css to manage margin-bottom...
my question is if possibile to remove/disable that main.css rule, or if in the next updates the code will be removed
thank you
Hi Fabio,
You can override it if needed by adding custom CSS.
Try adding this CSS:
.footer-widgets .widget :last-child, .sidebar .widget :last-child {
margin-bottom: 1.5em;
}
Here's how to add CSS - https://docs.generatepress.com/article/adding-css/
yeah thank you for reply!
unfortunately i already test, the problem is that override the last-child but also override the h4.gb-headline-633d60a5 (because of a less priority) margin-bottom so i can't manage it from GP blocks Options in gutenberg )
here the css generated:
.footer-widgets .widget :last-child, .sidebar .widget :last-child {
margin-bottom: 1em;
}
.footer-widgets .widget :last-child, .sidebar .widget :last-child {
margin-bottom: 0;
}
h4.gb-headline-633d60a5 {
font-size: 16px;
font-weight: bold;
padding: 0 0 5px;
margin-bottom: 20px; <---- this cose is overwritten from the 1em instruction
border-width: 0 0 2px;
border-style: solid;
display: inline-block;
}
for now i resolved using h4.gb-headline-633d60a5 padding and/or adding an empty space
but i really would like in future that this last-child instruction will be removed, well, not removed, maybe check if there is only one line, so remove the last-child instruciont
Hi there,
the best solution to the issue is to use the Group Block ( or a GB Container Block ), so you can actually keep your title and the widget/content contained - see here:
https://docs.generatepress.com/article/grouping-widgets/
But we will be reviewing these kinds of styles in future updates.
You
Are
My
Hero
and i promise a will learn how to read documentation before writing anything else :-P
thank you so much
Fabio
Haha - glad to be of help.