Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Single price grid component

@mateorinland

Desktop design screenshot for the Single price grid component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


I'm definitely doing something wrong with grid. I built mobile first and it was all fine but then when I adjusted desktop the sizes of the boxes were different in mobile so I just "fixed it" by giving different paddings for each box. There's gotta be a better way.

Community feedback

@aykutminikli

Posted

Hello, congratz on finishing the challenge!

From what i see, the auto in

.card > * {
 max-width: 100%;
 margin: 0 auto 0;
}

distrupts your sizes of boxes. Can you try removing that line completely or auto and try the changes i said below.

It shows you declared 1 column in the code below

@media only screen and (min-width: 1024px)
.card {
    grid-template-columns: 1fr;
    grid-template-rows: 40% 50%;
    max-width: 35rem;
}

in dekstop version if you want 2 even columns width you should making it by grid-template-columns: 1fr 1fr; or grid-template-columns: repeat(2, 1fr);

also you should try making your rows by grid-template-rows: repeat(2, auto). This will create two rows with auto heights.

After you make this changes you can give same paddings to your sections.

Hope this was helpful.

Marked as helpful

1

@mateorinland

Posted

@aykutminikli Thanks a lot, it looked well before but now the paddings are better while the code is tidier and more coherent!

0

Please log in to post a comment

Log in with GitHub
Discord logo

Join our Discord community

Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!

Join our Discord