Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted 12 months ago

001-qr-code-component - HTML, CSS custom properties, CSS Flexbox

P
tomhaeck•120
@tomhaeck
A solution to the QR code component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


What are you most proud of, and what would you do differently next time?

Vertical centering of the card in the browser window can be done by setting the body's height to 100vh and declaring it a flexbox container. Flexbox items with margin: auto are centered both horizontally and vertically within the container.

CSS variables with a global scope can be declared in a pseudo :root element.

    :root {
      --white: hsl(0, 0%, 100%);
    }

Customization of default CSS values for all elements can be done as follows:

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
What challenges did you encounter, and how did you overcome them?

The figma design file was inspected to check paddings, line heights and word spacings. Although these spacing values were adopted in my implementation, there is still a small vertical offset between the card text in my implementation vs. the frontendmentor.io solution.

Code
Loading...

Please log in to post a comment

Log in with GitHub

Community feedback

No feedback yet. Be the first to give feedback on tomhaeck's solution.

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

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License