Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Responsive landing page using CSS Grid & Flexbox

@techmatlock

Desktop design screenshot for the Recipe page coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

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.

Community feedback

@VickyAzola

Posted

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

1

@techmatlock

Posted

Hi @VickyAzola!

Good point on using the main tag instead.

I was going to use a table but decided against it because I couldn't figure out how to make the table data elements all line up in a perfect vertical fashion so I went with grid instead. The 277kcal, 0g, 20g, etc. weren't lined up correctly when I applied padding to them.

I'll go ahead and make the changes on the ol li::marker rule.

I missed that mobile design feature even though I looked at the previews. Woops.

Thank you so much for the detailed feedback!

1

Please log in to post a comment

Log in with GitHub
Discord logo

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