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 CSS Flex

Aaron Li 90

@aaronli722

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


  1. Is there a common practice of the css properties order? for example, display comes first, then width/height, and then margin/padding, etc?

  2. When to use class, when to use id?

In my concept, id is use when the element is unique, for example #card in this challenge. But when I studied the html code of other pages, I found that they may also use class to describe unique element. So when to use class, when to use id?

Community feedback

@Vitiyah

Posted

Hi Aaron, there are no rules/order for general properties, for example width can be followed by height or height followed by width. But for certain types of CSS properties such as flexbox and grid.You cannot place align-items: center first without declaring display: flex. Imagine it like an onion layer.

And for your question on when to use id and class, you're correct, the basic difference is that id is for unique element and class can be used many times for all the elements that you want to apply a particular styling. But class can also be used for unique elements. I preferably use class all the time for styling purpose and use id for Javascript purposes to just select a particular element.

Marked as helpful

0

Aaron Li 90

@aaronli722

Posted

@Vitiyah Thanks for your advice! I just started learning Javascript, I think I will have more understanding of your advice when I start adding Javascript to my codes~

0
Hassia Issah 50,670

@Hassiai

Posted

Add the alt attribute alt=" " to the img tag to fix the error issue. The value of the alt attribute is the description of the image.

To center #card on the page using flexbox, replace the height in #background with min-height: 100vh.

Hope am helpful.

Well done for completing this challenge. HAPPY CODING

Marked as helpful

0

Aaron Li 90

@aaronli722

Posted

@Hassiai Thank you! Codes amended~

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