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

drallasβ€’ 375

@Drallas

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


Submitted my v1 version for the Single Price Grid Component, it more work than it seems up front.

My questions:

Should the grid shrink on resize?

Currently width and heights of the grid container is fixed is this ok, or what else is recommend to make sure the items fill up enough space?

Community feedback

P
Graceβ€’ 27,590

@grace-snow

Posted

I'm afraid this doesn't work on mobile. Content is cut off at the top and bottom.

0

P
Graceβ€’ 27,590

@grace-snow

Posted

This will be the biggest problem:

.main__wrapper {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

By positioning the whole page content absolutely you are taking it out of the document flow, so none of its size is considered on the page.

You definitely don't want a height and width on that grid either. Once the above is fixed, you shouldn't need them. Just a max width that's all.

I hope these pointers help

1
drallasβ€’ 375

@Drallas

Posted

@grace-snow

I knew it was not completely ok, so I did so more research and decided on:

.main__wrapper {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 100vh;
  align-items: center;
  justify-items: center; 
}

converted all width / height values to max-values and the component still seems fine to me!?

0
P
Graceβ€’ 27,590

@grace-snow

Posted

@Drallas why would you want rows to be 100vh??

You don't need any widths and heights, just let the grid template manage everything

0
drallasβ€’ 375

@Drallas

Posted

@grace-snow

grid-template on .grid-container is setting the values now...

Don't know yet how to get rid of grid-template-rows: 100vh on the .main__wrapper, without it's not vertically aligned..

0
P
Graceβ€’ 27,590

@grace-snow

Posted

@Drallas oh you mean on how you're centering on the page? I normally just use display grid place content center, no template rows or columns needed. Maybe that depends on whether it's also min-height 100vh... πŸ€” Or maybe I put that on the body... I can't even remember what I do now it's just automatic πŸ˜‚

0
drallasβ€’ 375

@Drallas

Posted

@grace-snow directly height: 100vh; on the .main_wrapper seems to work. Thanks for your tips and time!

0
Raymart Pamplonaβ€’ 16,090

@pikapikamart

Posted

well I think you don't necessary need to fill the space. well sometimes it is more appealing when taking whole the viewport like when it is mobile, but sometimes not filling can weigh up more than filling the whole. Depends on looks good right, but if the challenge's design is that, then we'll just copy it right^

0

drallasβ€’ 375

@Drallas

Posted

@pikamart Yes if the design doesn't specify it, I'm also inclined to just go for a copy.. But when such component end up in a page, it might be more responsive. I'm still finding out what the best practices are.

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