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

my-four-card-feature-section-challenge-solution

itcss
Usanase Makala•330
@usanCode
A solution to the Four card feature section challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)
Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Grace•32,130
    @grace-snow
    Posted about 3 years ago

    Hi

    There is loads on here that doesn't need to be on here. If you worked mobile first, your code would be a lot shorter. You also have a lot of duplication across each card. They have loads of shared styles so can have one class that does all of that. Then they each need one extra class, or you can use a selector like nth child to target each one and override the border color, and then the grid position on desktop.

    Here is what I just changed in browser. Most of it was commenting out unnecessary duplication in media queries

    /* main.css | https://usancode.github.io/four-card-feature-section-master/four-card-feature-section-master/main.css */
    
    .grid-container {
      /* width: 58rem; */
      /* height: 30rem; */
      /* padding-top: 2%; */
      /* padding-bottom: 2%; */
      max-width: 58rem;
    }
    
    @media screen and (max-width: 820px) {
      .grid-container {
        /* width: 52rem; */
        /* height: 30rem; */
        /* display: grid; */
        /* grid-template-rows: 1fr 1fr 1fr 1fr; */
        /* grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr; */
        /* row-gap: 1.5rem; */
        /* column-gap: 1.5rem; */
        /* margin: auto; */
        /* padding-top: 2%; */
        /* padding-bottom: 2%; */
        /* justify-content: center; */
        grid-template-columns: auto;
      }
      body {
        /* background-color: hsl(0, 0%, 98%); */
        /* margin-right: 4%; */
        /* margin-left: 3%; */
        /* margin-top: 5%; */
        /* margin-bottom: 5%; */
        /* max-width: 1440px; */
        /* width: 100%; */
        /* justify-content: center; */
      }
    }
    
    body {
      /* margin-right: auto; */
      /* margin-left: auto; */
      /* max-width: 1440px; */
      /* width: 100%; */
      /* justify-content: center; */
      margin: 0;
      padding: 1rem;
    }
    
    .heading {
      /* line-height: 0.4rem; */
      /* text-align: justify; */
      /* text-justify: distribute-all-lines; */
      /* justify-items: center; */
      /* margin: auto; */
      /* padding-bottom: 0.5rem; */
      /* grid-column-start: 1; */
      /* grid-column-end: 2; */
      /* grid-row-start: 1; */
      /* grid-row-end: 2; */
      line-height: 1.3;
      note: line height should be unitless;
    }
    
    .mainBlock {
      /* display: grid; */
      /* grid-template-columns: 100%; */
      /* grid-template-rows: 30% 30%; */
      note: why all these divs?;
      margin-bottom: 1rem;
    }
    
    .mainContainer {
      /* width: 75%; */
      /* margin: auto; */
      /* justify-content: center; */
      margin: 0 auto 2rem auto;
      text-align: center;
    }
    
    .motto {
      /* width: 50%; */
      max-width: 50ch;
    }
    
    @media screen and (max-width: 540px) {
      .mainBlock {
        /* display: grid; */
        /* grid-template-columns: 100%; */
        /* grid-template-rows: 30% 30%; */
      }
      .mainContainer {
        /* width: 100%; */
        /* margin: auto; */
        /* justify-content: center; */
      }
      .heading {
        /* line-height: 0.4rem; */
        /* text-align: justify; */
        /* text-justify: distribute-all-lines; */
        /* justify-items: center; */
        /* margin: auto; */
        /* padding-bottom: 0.5rem; */
        /* grid-column-start: 1; */
        /* grid-column-end: 2; */
        /* grid-row-start: 1; */
        /* grid-row-end: 2; */
      }
      .motto {
        /* text-align: justify; */
        /* justify-items: center; */
        /* width: 15rem; */
        /* height: 3rem; */
        /* margin: auto; */
        /* padding-bottom: 0.3rem; */
        /* font-size: 14px; */
      }
      .grid-container {
        /* display: grid; */
        /* grid-template-columns: 16rem; */
        /* grid-template-rows: 13rem 13rem 13rem 13rem; */
        /* width: 20rem; */
        /* height: 56rem; */
        /* row-gap: 1rem; */
        /* justify-content: center; */
        /* margin: auto; */
        /* padding-top: 2%; */
        /* padding-bottom: 2%; */
      }
      .firstBlock {
        /* border-top-style: outset; */
        /* border-top-color: hsl(180, 62%, 55%); */
        /* background-color: hsl(0, 0%, 98%); */
        /* border-radius: 0.2rem; */
        /* box-shadow: 0.1rem 0.5rem 0.5rem hsl(229, 6%, 66%); */
        /* padding-bottom: 1rem; */
        /* padding-left: 2rem; */
        /* padding-right: 2rem; */
      }
      .secondBlock {
        /* border-top-style: outset; */
        /* border-top-color: hsl(0, 78%, 62%); */
        /* background-color: hsl(0, 0%, 98%); */
        /* border-radius: 0.2rem; */
        /* box-shadow: 0.1rem 0.5rem 0.5rem hsl(229, 6%, 66%); */
        /* padding-bottom: 1rem; */
        /* padding-left: 2rem; */
        /* padding-right: 2rem; */
      }
      body {
        /* width: 100%; */
        /* background-color: hsl(0, 0%, 98%); */
        /* justify-content: center; */
      }
    }
    
    // Usually a css reset at the start will remove browser styles like margin on headings 
    h1, h2 {
      margin: 0;
    }
    
    
    Marked as helpful
  • Grace•32,130
    @grace-snow
    Posted over 3 years ago

    This doesn't look like the design yet, it doesn't look finished. Don't rush through lots of challenges without pausing to reflect, refator and learn

    It's also really important that you Indent your code consistently. Your code editor can even format everything for you.

    Also important for headings to be correctly structured and in the right order. You can't skip heading levels

    Slow down

    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.

Frontend Mentor for Teams

Frontend Mentor for Teams helps companies and schools onboard and train developers through project-based learning. Our industry-standard projects give developers hands-on experience tackling real coding problems, helping them master their craft.

If you work in a company or are a student in a coding school, feel free to share Frontend Mentor for Teams with your manager or instructor, as they may use it to help with your coding education.

Learn more

Oops! 😬

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

Log in with GitHub

Frontend Mentor for Teams

Frontend Mentor for Teams helps companies and schools onboard and train developers through project-based learning. Our industry-standard projects give developers hands-on experience tackling real coding problems, helping them master their craft.

If you work in a company or are a student in a coding school, feel free to share Frontend Mentor for Teams with your manager or instructor, as they may use it to help with your coding education.

Learn more

Oops! 😬

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

Log in with GitHub