Cooding bootcamp slider solution with HTML, SASS and JS
Design comparison
Solution retrospective
hi guys, I am not happy with my effort on this project. I used CSS-grid for the first time to create this component just to practice it on a small project. But I was not able to code my solution efficiently. I am struggling with minmax and auto-fit property of CSS-grid. This code is getting messed up in (max-width: 800px min-width: 1200px) so feel free to suggest something for code.
Community feedback
- @mattstuddertPosted about 4 years ago
I don't think you've done a bad job, Amol! Using Grid is great, but I would actually not use
minmax
andauto-fill
in this instance. For me, they're perfect for pages where you have lots of rows and columns of items, like the/challenges
page on this site, for example. On something like this, I'd just use a media query to change the layout. You definitely can play around with theminmax
and get it working for this solution, but it would be my preference not to use it for this kind of layout.I'd also recommend trying to go mobile-first and use
min-width
media queries instead ofmax-width
. This often leads to less code, so it would get rid of some of the repetition.Don't be too hard on yourself though. You've done a good job! 👍
0@Amol-ShrivastavaPosted about 4 years ago@mattstuddert thanks matt, but I need to work to more on my CSS grid. What you suggest should be my criteria for deciding width for columns in a CSS grid, because this is the biggest confusion that I have, like how to decide the width of the column. So to solve this I use a
minmax
trick of defining columns minimum be25rem
and at max can grow to1fr
. Also, every video for the CSS grid appreciatesauto-fit
andauto-fill
, so beginners like me think that it is the bypass for writing media queries to change the layout.0@mattstuddertPosted about 4 years ago@Amol-Shrivastava
minmax
mixed withauto-fill
orauto-fit
is great, but media queries are still a valid way to change the layout. Whether you useminmax
or media queries will depend on the situation. But you'll get more and more comfortable with it the more you practice. So I wouldn't worry too much about the details at this point. I would keep practising and move onto the next project. You can always then come back to this one and refactor it, which would be a great exercise.0@Amol-ShrivastavaPosted about 4 years ago@mattstuddert thanks matt for your guidance
0
Please log in to post a comment
Log in with GitHubJoin 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