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
Cannot read properties of null (reading 'code')
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

3 column grid card

Arun 90

@ninjabro

Desktop design screenshot for the 3-column preview card component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


hi there. i've completed almost another challenge 🎉. could you clear my doubts?

could please check my code and advise me on why is the attribution doesn't work for mobile screen as expected? thank you. ❤🙏

Community feedback

Vanza Setia 27,855

@vanzasetia

Posted

Hi, Arun! 👋

I am guessing that the "expected" thing that you mean is the attribution should be below the cards.

Next time, you should explain the expected thing. This way, people know exactly what you are trying to accomplish. 🙂

So, to achieve that you need to remove some of the code.

.container {
  /* width: 920px; */
  Note: set max-width instead
  /* height: 500px; */
  Note: let the content controls the height of it
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  justify-self: center;
  align-self: center;
  border-radius: 15px;
  overflow: hidden;
}

@media (max-width: 600px) {
  body {
    /* flex-direction: row; */
    justify-content: center;
    align-items: center;
    min-height: 100vh;
  }
}

Another suggestion is to not repeat the same styling inside the media query.

body {
  background-color: var(--Very-light-gray);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

@media (max-width: 600px) {
  body {
    flex-direction: row;
    /* justify-content: center; */
    /* align-items: center; */
    /* min-height: 100vh; */
  }

All the codes that I commented on above are code that already exists outside the media query. So, there is no need to repeat those lines of code.

Also, never use px unit for font sizes. Use rem or em instead. Relative units such as rem and em can adapt when the users change the browser's font size setting.

I hope you find this useful.

Marked as helpful

1

Arun 90

@ninjabro

Posted

@vanzasetia hi thank you for your time. ive changed units to rem and removed repeated codes.😀

0
Vanza Setia 27,855

@vanzasetia

Posted

@ninjabro

Good! 👍

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