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

Responsive preview card using CSS Grid & Flexbox

@VFGarciaDev

Desktop design screenshot for the Blog preview card coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


What are you most proud of, and what would you do differently next time?

I'm most proud of using 'rem' in the majority of the project instead of 'px' to get a better responsive layout

What specific areas of your project would you like help with?

I'm always open for new tips and suggentions and would love to chat with someone about it.

Community feedback

P

@Islandstone89

Posted

Well done, Victor.

A few suggestions:

HTML:

  • Don't use "image" in the alt text, as screen readers announce that by default.

  • Use the <time> element for the date:<p>Published <time datetime="2023-12-21">21 Dec 2023</time></p>.

  • The link should be inside the heading, not the other way around.

CSS:

  • Changing the font size is not a good idea.

  • Move font-family to body.

  • Add around 1rem of padding on the body, so the card doesn't touch the edges on small screens.

  • On the body, change height to min-height - this way, the content will not get cut off if it grows beneath the viewport.

  • max-width on card should be in rem.

  • Remove max-height on the top image.

Marked as helpful

1

@VFGarciaDev

Posted

@Islandstone89, Thank you for all your suggestions. I found everything very interesting and helpful, including the article about font-size. I'll try to implement more of your suggestions. I just have two questions about the CSS suggestions.

  • Instead of rem, could I use '%' when assigning the 'max-width' on the card?
  • What should I do to prevent the image of remaining on its original size if not using max-height/width?
1
P

@Islandstone89

Posted

@VFGarciaDev Glad to help :)

  • No, use rem for max-width.

  • To prevent images from spilling out of their container, it is common to include the following in a CSS Reset, which should be added at the beginning of every stylesheet:

img {
  display: block;
  max-width: 100%;
}

Marked as helpful

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