XF 2.1 How to use :last-child for grid

SyTry

Well-known member
Hello,

Actually I'm making an add-on for XenForo 2.1, I have a page to show my partnerships like this :
Screenshot_1.webp

The problem is the width for the last grid, I want it to be 100% or I want to show my partnerships like this :
Partner 1Partner 2
Partner 3Partner 4
Partner 5Partner 6

This is my HTML :
Code:
<div class="stPartnerList">
    My HTML here
</div

And my CSS :
Code:
.stPartnerList {
    display: grid;
    grid-template-columns: repeat( auto-fit, minmax(300px, 1fr) );
    grid-gap: 10px;
    padding: 10px;

    &:last-child {
        grid-template-columns: 100%;
    }
}

Also tried .stPartnerList:last-child {} but nothing to do :unsure:
If anyone have an idea or a solution, please let me know ! :)

Regards, SyTry
 
Never worked with grid, but I assume you can do that with flex - with better browser support.

 
Never worked with grid, but I assume you can do that with flex - with better browser support.

Thank you for the tip, this site is very cool ! But I can't find a solution, the last column doesn't want to take 100%. :unsure:

EDIT : got it, not what I want but I changed this grid-template-columns: repeat( auto-fit, minmax(300px, 1fr) ); to grid-template-columns: auto; ;)
 
Last edited:
Top Bottom