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

@media, css grid

@vitorialrd

Desktop design screenshot for the QR code component 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?

Maybe I can frame the divs better

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

Media query, Responsive design

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

Css grid

Community feedback

P

@justinconnell

Posted

Hi @vitorialrd,

Congratulations on submitting your solution!

I noticed that you did use flexbox in your solution and thought the following resources will be helpful - I included CSS Grid because you asked about grid:

The trick is to have a container that takes up 100vh (100% of the viewport height) and 100vw (100% viewport width) and then to centre the child element in the container element.

In your code this can be done with the following changes:

body {
    background-color: hsl(212, 45%, 89%);
    font-family: "Outfit", sans-serif;
    /* margin-top: 40px; */
}

.container {
    /* display: block; */
    /* margin: auto; */
    height: 100vh;
    display: flex;
    /* align item vertically */
    align-items: center; 
    /* align item horizontally */
    justify-content: center;
}

Note, I commented out the unnecessary code above and included some comments on centring the content for convenience.

To answer your question on CSS Grid, you can achieve the same effect as follows:

.container {
    height: 100vh;
    display: grid;
    place-content: center;
}

I hope you find this feedback helpful

Keep on coding! J

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