Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted 25 days ago

Blog Preview Card

HARSHIKA BANSAL•50
@harshikab2112
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?

I'm most proud of how clean and faithful my solution is to the original design. I ensured the card stays visually consistent across all screen sizes without compromising on layout or readability. I'm also proud that I maintained the semantic structure and kept the CSS modular, which made the project easy to maintain and update.

If I were to do it differently next time, I’d set up the project with a build tool like Vite or use Sass for better CSS organization and scalability. I’d also explore adding subtle animations to enhance the user experience and make the card feel more interactive. Lastly, I’d challenge myself to make the component dynamic by integrating it with JavaScript or a framework like React.

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

One of the main challenges I faced was ensuring the card remained fixed in size while still being responsive on all screen sizes. Initially, the card would shrink on smaller devices due to incorrect use of width properties in media queries. I resolved this by setting a fixed width on the card and adjusting the body’s padding and layout instead of changing the card itself.

Another challenge was centering the card both vertically and horizontally without breaking the layout on mobile. I overcame this by using Flexbox on the body element and adding consistent padding to prevent the content from touching the screen edges.

These issues taught me the importance of using layout utilities like flex thoughtfully and being cautious with how media queries alter element sizing.

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

I'd love feedback on how to improve the structure and efficiency of my CSS. Specifically:

  • Are there better ways to handle responsiveness without writing extra media queries that affect card layout?

  • Could I have structured my CSS classes or variables in a more reusable or scalable way?

  • Are there best practices I missed when implementing hover and focus states for accessibility?

Also, if there are more modern layout techniques (e.g., using clamp() for font sizing or container queries), I’d appreciate pointers on how to apply those to small projects like this.

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Marzia Jalili•9,050
    @MarziaJalili
    Posted 25 days ago

    Beautiful work! 🔥

    🌟 A tiny point on semantics?

    ✅ First, headings should follow a logical (ordinal) structure for accessibility and SEO purposes. You're skipping <h2>, jumping from <h1> to <h3>, which is not semantically correct, buddy.

    h1 → h2 → h3 → h4 → h5 → h6
    

    I've never seen all of these used in one project, anyway. 😅

    ✅ Second, the author’s name is not meant to be a subheading (not a section title), so you could even use a <p> or <span> instead to represent a label not a heading:

    <p class="author-name">Greg Hooper</p>
    

    The web's looking great overall — keep up the grind! 💪😎🥇

    Marked as helpful
  • Abdul Subhan•1,440
    @Esabdul
    Posted 25 days ago

    You are using a <button> for a non-interactive label ("Learning"), semantically, this should be a <span> or <div>, or at least styled anchor if it's meant to be clickable.

    Second, there's no hover effect on the whole .card, only on .card-content, but since .card wraps only that one element, it feels bit redundant, you can merge them or remove the outer wrapper.

    Also, In your media queries, instead of repeating padding logic, you could use clamp() for font sizes and set some base padding for .card-content and override only where needed.

    Also, don't set height: 100vh on html, body, it can cause issues on mobile instead Use min-height.

    Lastly, your box-shadow on .card-content:active flips direction, which can feel jarring, consider using a subtle shadow inset or reduce the effect for smoother UX.

    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

Oops! 😬

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

Log in with GitHub