@DylandeBruijn
Posted
@hyperavtr
Hiya! 👋
Congratulations on your solution, it looks very close to the design! I can tell you put a lot of effort into it.
Things I like about your solution 🎉
- Use of semantic HTML elements
- Clear descriptive CSS classes
- Use of CSS custom properties
Things you could improve ✍️
-
I suggest adding a bit of
padding
to yourbody
element so the card has some space around it on smaller viewports. -
Try experimenting with the CSS layout tool Flexbox, it will help you greatly structuring elements on your webpage.
-
You could add a
min-height: 100vh
to yourbody
element so it takes up the full height of the viewport while still being able to grow when the content inside it grows. -
Try centering your card using Flexbox on the
body
. -
I suggest against using
figure
andfigcaption
for the card. These elements are used for images and captions. -
Try styling your elements using classes over ID's.
I hope you find my feedback valuable, and I would appreciate it greatly if you could mark my comment as helpful if it was! 🌟
Let me know if you have more questions and I'll do my best to answer them. 🙋♂️
Happy coding! 😎
Marked as helpful
@hyperavtr
Posted
@DylandeBruijn Hi, Thanks a lot, I'll follow your suggestions and fix things. But I have a question about using ID's and classes. I thought that choosing one of them for purpose of styling depends from what level of styling priority you want to assign to elements and from on how many elements per page this styling should to affect. For example, if number of the elements > 1 I should use classes due to its reusability. But if the case is unique, so why don't use the ID? Or ID's just needed for anchors on the page and for within labels and some similar things, or it's just a bad practice at all to use it for purpose of styling?
@DylandeBruijn
Posted
@hyperavtr
I use ID's rarely, speaking from my personal experience as a professional front-end developer. Cases where I use them:
- As anchors for navigation on a page.
- To select an element using Javascript.
- For something like a website logo, which is unique.
Important thing to know is that ID's can only exist once per page. And you'll run into trouble when you use them to style elements of reusable components like the blog card in this example. Because it's a very common design pattern to have multiple cards in a grid.
Note that you won't see any errors as HTML and CSS are designed to be very fault tolerant, most browsers will in fact apply the specified styles to all elements given the same ID. However, this is considered bad practice as it defies the W3C spec.
I hope that makes sense!
Marked as helpful
@hyperavtr
Posted
@DylandeBruijn Yeah, I got your point. Using classes for styling purpose will make code just more extensible. Thank you once again!