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

Four cards

JulienLachโ€ข 260

@JulienLach

Desktop design screenshot for the Four card feature section coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


Didn't manage to call the card for the top colors... Can anyone help me ?

Community feedback

@MelvinAguilar

Posted

Hello there ๐Ÿ‘‹. Good job on completing the challenge !

  • The issue is that the nth-child selectors are not working as expected because each .card is nested within a different .container, and the nth-child is based on the immediate parent.

    One solution: Instead of relying on nth-child to select specific cards, create separate classes for each color and apply them directly to the cards. This approach helps avoid complex and error-prone CSS selectors.

    You can add a specific class for each color to the cards like:

    <div class="card card-cyan">...</div>
    <div class="card card-orange">...</div>
    <div class="card card-red">...</div>
    <div class="card card-blue">...</div>
    

    css

    .card-red:after {
      border-top-color: var(--red-color);
    }
    .card-red:after {
      border-top-color: var(--blue-color);
    }
    ...
    
  • Another solution: Instead of having a separate .container for each .card, you can simplify your structure and use a single .container for all cards, but you need to change all the styles for the cards.
  • There's a lot of repeated code in your CSS. Consider consolidating common styles to make your code more concise and easier to maintain.

I hope you find it useful! ๐Ÿ˜„

Happy coding!

Marked as helpful

0

JulienLachโ€ข 260

@JulienLach

Posted

@MelvinAguilar Ok thank you !!

0

@MaximilianoDanielGarcia

Posted

Hi Julien, good job!

I think you should put the cards in the same container. After that you can organize them with a CSS grid.

Marked as helpful

0
sanju321GHโ€ข 270

@sanju321GH

Posted

yo hi, can i know your problem i couldn't understand what you were saying.

0

JulienLachโ€ข 260

@JulienLach

Posted

@sanju321GH Hello ! Thanks for your reply, my issue is : how to call one by one the cards for one color for each ? i've used the nth:child css property but didn't work , have you checked the code ?

0

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