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

I used flex for mobile mode and a grid for 1440px screen size.

Timic Iveyβ€’ 300

@Lwmeek

Desktop design screenshot for the Stats preview card component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


Is there a better way to center the whole card on the screen without using absolute positioning? Is there any best practices I can do better at implementing or any best practices I should be doing?

Community feedback

Vanza Setiaβ€’ 27,795

@vanzasetia

Posted

Hi, Timic! πŸ‘‹

Congratulations on completing your first Frontend Mentor challenge! πŸŽ‰

I have some suggestions for this solution.

  • Uppercase the text with CSS instead of manually uppercase the text in the HTML. The uppercased word in the HTML will be spelled by the screen reader (spelled letter by letter).
  • There's no need to have absolute positioning to position the card to the middle of the page. Instead, I would recommend adding justify-content: center; to the body element to center the card horizontally. Also, use min-height instead of hieght. Currently, on mobile landscape view the card is getting cut off on the top.
  • Adjust the breakpoint of the media query. It's too late to have a two columns layout on 1440px. Currently on my desktop view, 1280px * 800px, the card is so large. Just to let you know that, the sizes on the style-guide.md have nothing to do with the media queries. They are telling you that "this is how your website should look like at these screen sizes". As frontend developers, we should keep making your website looks good in between those screen sizes.

That's it! Hope you find this useful! 😁

Marked as helpful

2
Sebastianβ€’ 1,560

@dnksebastian

Posted

Hi,

in order to easily center your card with flexbox, use 'justify-content: center' on your 'body' element and remove the 'position' and 'left' properties from 'card_container'.

Hope this helps!

Marked as helpful

0
srglbrkchnβ€’ 260

@srglbrkchn

Posted

Hi,

How about :

.card_container { margin: 10px auto; }

10px does not matter, it's margin of top and bottom, you can set it to 0 if you wish. The auto, centers the card, it represents left and right margin. And then you can remove position: absolute and left property.

Happy coding!

1

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