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

QR code component solution using HTML and CSS

Hum Bruno 230

@humbruno

Desktop design screenshot for the QR code component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


  • I initially struggled with centering the card vertically on the page and after some researching, I found out that by applying min-height: 100vh to the body could accomplish this.
body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

I'm not entirely sure why exactly this works and if there are any more effective or clean ways to achieve this effect, I would love to know alternative ways to accomplish this!

  • This project was also a great to get into the habit of writing CSS variables for properties that I thought I would have to re-use throughout the code.

After reading about it on MDN, their recommendation was to apply these styles directly to the :root pseudo-class. Where do you apply your CSS variables?

:root {
  --white: hsl(0, 0%, 100%);
  --lightGray: hsl(212, 45%, 89%);
  --grayishBlue: hsl(220, 15%, 55%);
  --darkBlue: hsl(218, 44%, 22%);
}

Community feedback

Ollie 580

@ohermans1

Posted

Hey Mate

Looking awesome, well done!

Regarding your two questions:

  1. Centering - that seems like as good an approach as any. If you think about it, the main body needs a height, otherwise, what will the container know to centre too. So giving it a height of (at minimum) 100% of the view height allows it to know where it is centring.

  2. When using just plain old CSS and not a preprocessor (I use SASS/SCSS) it is good practice to put the variables in :root. I would recommend taking a look at a preprocessor like SASS, because it gives you the power to have a whole separate sheet dedicated to variables + much more powerful variables, like background-color: rgba($color-black, 0.7); for instance if you wanted a transparent version of a variable color you already have stored. There is a course on udemy call Advanced CSS and Sass which I found super helpful!

Cheers and keep up the good work.

Ollie

Marked as helpful

0

Hum Bruno 230

@humbruno

Posted

@ohermans1 Thanks for the feedback! I'll definitely take a look at preprocessors for CSS; I had heard of them before but was under the impression that they would be considered a more advanced skill.

0
Ollie 580

@ohermans1

Posted

@humbruno Sorry about the super slow response - I def found them easier than expected, once you've got a bit of a foundation with standard CSS.

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