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

Four card feature section using CSS Grid and Flexbox

P
Anamay•470
@anamaydev
A solution to the Four card feature section 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 am particularly proud of how smoothly I was able to implement layout using CSS Grid for the desktop version of my project. The process was surprisingly quick and efficient! Based on feedback from my peers on previous challenges, I made several improvements:

  • I replaced elements with tags to enhance semantic HTML.
  • I utilised @font-face to incorporate custom fonts, reducing reliance on third-party CDNs.
  • I added a `` description to enhance SEO, which is a crucial aspect of web development that I wanted to prioritise.
  • I also remembered to include alt attributes for images this time, which I often forget.

I would focus more on optimising for mobile layouts from the beginning to ensure a seamless experience across all devices.

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

I encountered a significant challenge when trying to create a top color border for each card. Initially, I attempted to use border-top, but I noticed that there were slight curves on both the left and right sides, which didn't align with the card's design. To address this, I created a new div called card-line-* and set its height and width accordingly.

However, this approach led to another issue: the card-line-* div was overflowing and not conforming to the card's border-radius. After doing some research online, I discovered the overflow: hidden property, which resolved the issue and allowed the card-line-* to fit perfectly within the card's rounded borders.

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

I’d love feedback on my code to see how I can improve it, as I always learn something new from the insights I receive.

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • P
    Steven Stroud•11,890
    @Stroudy
    Posted 9 months ago

    I use this site to get my .woff2 fonts

  • P
    Steven Stroud•11,890
    @Stroudy
    Posted 9 months ago

    Hey, You smashed this challenge, Incredible work on this! You’re making great strides, and I have a couple of suggestions that might push it even further…

    • Using font-display: swap in your @font-face rule improves performance by showing fallback text until the custom font loads, preventing a blank screen (flash of invisible text). The downside is a brief flash when the font switches, but it’s usually better than waiting for text to appear.

    • I think you can benefit from using a naming convention like BEM (Block, Element, Modifier) is beneficial because it makes your CSS more organized, readable, and easier to maintain. BEM helps you clearly understand the purpose of each class, avoid naming conflicts, and create reusable components, leading to a more scalable codebase. For more details BEM,

    • Using rem or em units in @media queries is better than px because they are relative units that adapt to user settings, like their preferred font size. This makes your design more responsive and accessible, ensuring it looks good on different devices and respects user preferences.

    @media only screen and (max-width: 1024px) and (min-width: 551px)
    
    • It is good to see you hosting your own fonts, Consider hosting fonts in a .woff2 format, .woff2 is a highly compressed version of fonts, reducing the file size significantly (up to 30% smaller than WOFF, and much smaller than TTF). This smaller size improves website loading times and reduces bandwidth usage. .ttf is better suited for desktop applications or systems that don’t require the same web-specific performance or compression standards.

    It is really nice to see you making changes based on my feedback, You’re doing so well, and I hope this feedback is helpful! Keep honing your skills and remember to enjoy the process—you’re on a great path. Stay motivated, and happy coding! 🎯

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