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

CSS and HTML

@tunabearfish

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 had trouble with using CSS, when to use px, vh, or %

Community feedback

fiza saif 140

@fizasaif123

Posted

Use px for fixed-size elements and precise control. Use % for relative sizing within parent containers in responsive layouts. Use vh and vw for elements that should scale with the viewport size in responsive designs.

2

@george5-star

Posted

Congratulation Steven for completing the project and I hope you had fun building it. Regarding you question on which unit to use I recommend the using rem or em which is explained in the code samples below:


<div>
  <h1>Some text</h1>
</div>


h1 {
  padding: 1em;  //  which is equal to 16px and it is relative to its parent div.
}

h1 {
  padding: 1rem; // this is relative to the root element which is the html tag.
}

So I recommend using em for paddings and margins and rem for font-sizes. Also this link will provide you with a brief overview on them.

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