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

aplication, responsivo, mobile, desktop

@fabiofmachida

Desktop design screenshot for the Results summary component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


Hi guys, creating the structure in HTML was relatively easy, where I had the most difficulty was making the application responsive, and I believe that my CSS code was not optimized, I would like if someone could give me tips on how to make the code more optimized. Thank you guys

Community feedback

P
Jeuri Morel 1,405

@JeuriMorel

Posted

Instead of trying to vertically center the card by giving it a margin top of Xpx, which will not be consistent due to screens of different sizes, make the body a flex container and then center things that way. First give it a height: 100vh; so that it takes up the whole screen, then give it:

    display: flex;
    justify-content: center;
    align-items: center;

This will perfectly center the card horizontally and vertically, so no need for all those margin- X : auto;.

I see all the bars (bar1, bar2, etc) share most of the same code except for color. Maybe you can give them an additional class of "bar" (or whatever name you like) and put the code that they all share there, and then use the class names that are specific to each for color. So for example your code could look like this:

.bar {
    width: 280px;
    height: 56px;
    border-radius: 10px;
    position: relative;
    margin-left: 410px;
    margin-top: 29px;
}

.bar1 {
    background: hsl(0, 14%, 95%);
}
.bar2 {
    background: hsl(38, 76%, 94%);
}
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