Design comparison
Solution retrospective
-
Is there a common practice of the css properties order? for example, display comes first, then width/height, and then margin/padding, etc?
-
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
- @VitiyahPosted almost 2 years ago
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 helpful0@aaronli722Posted almost 2 years ago@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 - @HassiaiPosted almost 2 years ago
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 helpful0
Please log in to post a comment
Log in with GitHubJoin 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