Used HTML and CSS Flexbox to center and style a responsive QR card.

Solution retrospective
I’m most proud of successfully centering the card using Flexbox and replicating the design with accurate spacing, colors, and typography. It was my first time fully implementing a UI from a design, and seeing it match the original made me feel confident.
Next time, I’d focus more on making the layout responsive across various screen sizes and explore using CSS variables for better consistency. I'd also try organizing the CSS into reusable utility classes for cleaner code.
What challenges did you encounter, and how did you overcome them?One of the main challenges was centering the card both vertically and horizontally on the page. I initially struggled with traditional methods like margin and positioning, but after learning about Flexbox, I was able to center the content using display: flex, justify-content: center, and align-items: center. I also had difficulty with spacing and alignment inside the card, which I fixed by carefully adjusting padding and using text-align: center.
What specific areas of your project would you like help with?I’d like help improving the responsiveness of my layout so it looks good on all screen sizes. I'm also interested in learning best practices for organizing CSS, especially how to write cleaner, more reusable styles. Additionally, feedback on how to improve accessibility (like proper use of alt text or ARIA roles) would be really valuable.
Please log in to post a comment
Log in with GitHubCommunity feedback
- P@edjohnsondev
This is looking really good!
When organising your CSS, you have two main options for managing things like colours and spacing:
-
reusable classes: You could setup classes for the 2 different font styles, and then apply them to the HTML wherever needed.
-
Root-level variables: Setting up root variables means you tweak a value in one place and the change ripples through your whole stylesheet.
It's also handy when setting these up to follow the Design System, in the Figma file under pages you'll find this. By naming your variables or utility classes exactly as they appear, if something is changed you can quickly go through and find them without having to look for the hex code etc..
So for example:
:root { --slate-900: #1F314F; }
Then you can use these like
.card h2 { color: var(--slate-900); }
I hope this helps!
Marked as helpful -
- @panhongfu
n
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