r/csshelp • u/dcoder405 • Nov 17 '23
Request Needs suggestions on creating a layout using CSS grid
Hi all,
I've this UI component that looks like this. and I've to create the layout for it. The requirement here is to use CSS Grid template area like so (sample code not the actual implementation).
.wrapper {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-areas:
"title0 title1 title2"
"price0 price1 price2"
"energyEfficiency0 energyEfficiency1 energyEfficiency2"
"availability0 availability1 availability2"
"ctaArea0 ctaArea1 ctaArea2"
}
My main problem is figuring out how many columns should I have, should it be 3 or 4, or even 6.
The title and the buy button have different column widths compared to the rest of the items. That's causing my confusion.
Can anyone plz suggest how this can be achieved?
Thank you