Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted 3 months ago

Blog preview card challenge

P
Sascha Wagner•70
@Sascha-Wagner99
A solution to the Blog preview card challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


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

Big thanks to @Islandstone89 for the super helpful feedback on my first project! I’m most proud that I was able to apply that feedback—not just to the previous project, but also to this one. I really tried to carry over those best practices and improve overall quality.

What challenges did you encounter, and how did you overcome them?

I learned that img tags are inline elements by default, which can cause unexpected whitespace gaps in the layout. These gaps aren’t always obvious in developer tools, which makes debugging tricky. I fixed it by setting display: block; on the images.

Another thing I discovered: Flexbox’s default align-items value is stretch, which made some elements take up more space than intended. Setting align-items: flex-start; gave me the alignment I actually wanted.

What specific areas of your project would you like help with?
  • How can I avoid unnecessary styles in my CSS file?
  • How do you usually handle fonts? My font setup ends up using a lot of lines.
  • What’s the best way to deal with different font sizes or styles on mobile/desktop? Do you rely on media queries or is there a cleaner way?
Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • P
    Øystein Håberg•13,260
    @Islandstone89
    Posted 3 months ago

    Well done once again!

    A few suggestions:

    HTML:

    • Instead of having a background image in .image-container, I would remove that <div> and place the image in the HTML:<img src="assets/images/illustration-article.svg" alt="">

    • I would wrap the date in the <time> element: <p class="text-preset-3>Published <time datetime="2023-12-21">21 Dec 2023</time></p>.

    CSS

    • Remove font-size: 62.5% on html ,as changing the font size is bad for accessibility. You'll need to adjust your font sizes in the Custom Properties.

    • On the body, change padding-inline to padding - without padding at the top and bottom, the card squeezes against the edges.

    • max-inline-size on the card should be in rem, for example 20rem. You don't need to use the min() function, and it's not recommended to use % for properties like inline-size, margin, padding or border-radius.

    • Media queries should be in rem or em instead of px.

    Marked as helpful

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
Frontend Mentor logo

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

How does the accessibility report work?

When a solution is submitted, we use axe-core to run an automated audit of your code.

This picks out common accessibility issues like not using semantic HTML and not having proper heading hierarchies, among others.

This automated audit is fairly surface level, so we encourage to you review the project and code in more detail with accessibility best practices in mind.

How does the CSS report work?

When a solution is submitted, we use stylelint to run an automated check on the CSS code.

We've added some of our own linting rules based on recommended best practices. These rules are prefixed with frontend-mentor/ which you'll see at the top of each issue in the report.

The report will audit all CSS, SCSS and Less files in your repository.

How does the HTML validation report work?

When a solution is submitted, we use html-validate to run an automated check on the HTML code.

The report picks out common HTML issues such as not using headings within section elements and incorrect nesting of elements, among others.

Note that the report can pick up “invalid” attributes, which some frameworks automatically add to the HTML. These attributes are crucial for how the frameworks function, although they’re technically not valid HTML. As such, some projects can show up with many HTML validation errors, which are benign and are a necessary part of the framework.

How does the JavaScript validation report work?

When a solution is submitted, we use eslint to run an automated check on the JavaScript code.

The report picks out common JavaScript issues such as not using semicolons and using var instead of let or const, among others.

The report will audit all JS and JSX files in your repository. We currently do not support Typescript or other frontend frameworks.

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub