Design comparison
Solution retrospective
In the cards layout i tried multiple codes until it worked. so i would like to know, how should i do the layout effectively? what CSS properties should i use or how should i approach the layout problems? any tips would be appreciated, Thanks for reading!
Community feedback
- @MaRou-CodePosted over 3 years ago
Hi there, I'm a newbie as well but I think I might have some advice for you. I might be mistaken since this is just my own undestanding of the readings I've been through to overcome some of the challenges I've taken.
- HTML
- You shouldn't be using so many classes, especially classes like
.main
,.h3
, ... They're useless since you could simply use the plain selector in your CSS (main
,h3
, ...) - You sometimes seem to get classes and Id's mixed up (
.para-1
,.h2-1
,#container
, ...). A class should be reusable while an id is unique. Therefore, creating a class for one unique component, as specific as the 1st paragraph for example, is not very usefull and especially not what a class is meant for. In the contrary, an id should be so specific as not to be used twice. Furthermore, it is not considered as best practice to include id's in your CSS, so we should use them sparsely. - Now, focusing on the pure structure of your HTML, I noticed two elements that could be improved :
.para-2
and.para-3
. **Para-2: ** In my opinion, you should avoid using break lines when you could simply and more effectively use two separate paragraphs. **Para-3: ** you should use an unordered list instead of the one paragraph you divided with break lines.
- CSS
- They are many ways to be very specific in your CSS that prevent you from using so many classes - which will lead to a mess on larger scale projects - such as child selectors, descendant selectors, combinators, and so on.
- I used the grid approach to obtain the card layout and the flexbox approach to center horizontaly and verticaly the card.
I've noticed some other minor details but in order to keep it relatively short, I would suggest to adress these issues first.
Have fun programming !
1
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