Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted about 1 year ago

Responsive landing page using CSS Grid & Flexbox

Mark Matlock•20
@techmatlock
A solution to the Recipe page 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 making it responsive to different screen sizes since it's my first time using media queries and maintaining consistent CSS class names.

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

I encountered a problem where I can't remove the last divider line in the nutrition table I created using CSS grid. The part after the fat nutrition facts at the bottom. And I also couldn't get my ordered list numbers to be the same font as the solution.

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

Removing the last divider line after the fat nutrition facts. Also I changed the font-family for the ordered list in the instructions and used the two fonts that were in the style guide but my numbers still don't look like the numbers in the solution url.

Other than that, just requesting to see if I followed best practices in my code. Thank you.

Code
Couldn’t fetch repository

Please log in to post a comment

Log in with GitHub

Community feedback

  • Victoria Azola Silva•1,290
    @VickyAzola
    Posted about 1 year ago

    Hi there! 👋 Awesome job completing this challenge. Here are a few tips that may interest you:

    First, it is important to use semantic HTML for accessibility purposes. Try wrapping your main content in the <main> tag instead of <div class="main__content">. And the attribution in a <footer>; also, it may be better to put the footer outside the recipe card. The code would look something like this:

    <main  class="main__content">
     <img src="assets/images/image-omelette.jpeg" alt="" class="main__content-image" />
     <h1>Simple Omelette Recipe</h1>
    .....
    </main>
    <footer class="attribution">
      Challenge by <a href="https://www.frontendmentor.io?ref=challenge" target="_blank">
      Frontend Mentor
      </a>. Coded by <a href="#">Mark Matlock</a>.
    </footer>
    

    Here you can find more info on why it is important to use semantic HTML for accessibility. 

    Second, in this challenge the last content represents a table, so in this case it is more semantically accurate to use the html tag <table> instead of <div class="nutrition__grid-container">. Here is an example:

    <table>
      <tbody>
         <tr>
            <th>Calories</th>
            <td>277kcal</td>
         </tr>
         <tr>
            <th>Carbs</th>
            <td>0g</td>
         </tr>
         <tr>
            <th>Protein</th>
            <td>20g</td>
         </tr>
         <tr>
            <th>Fat</th>
            <td>22g</td>
         </tr>
      </tbody>
    </table>
    

    Here you can find more info on <table> and how to use it.

    For the line, you can remove it like this if you use a table:

    tr {
        border-bottom: 1px solid hsl(30, 18%, 87%);
    }
    
    tr:nth-child(4) {
        border-bottom: none;
    }
    

    And like this, if you use your code:

    .item {
      padding: 1rem 0 1rem 1.2rem;
      border-bottom: 1px solid var(--clr-neutral-grey);
    }
    
    .item:nth-child(7), .item:nth-child(8)    {
      border-bottom: none;
    }
    

    For the numbers, it may be because you are using the property font-style instead of font-family:

    ol li::marker {
      color: var(--clr-secondary-raspberry);
      font-weight: var(--fw-bold);
      font-style: var(--ff-body);     ---> here
    }
    

    Lastly, for this challenge, there were two designs, one for mobile and the other for desktop. Check out the design folder and look for mobile-design.jpg image. In this case, the mobile design doesn't have any background, and the content takes up all the screen. When it is on desktop the background appears.

    Hope this helps!

    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