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

Stats Preview Card with HTML and CSS

P

@myrojoylee

Desktop design screenshot for the Stats preview card component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


Almost done my first ever week of coding!

Here was my main issue in this one: How do I specify a width and height for both mobile and desktop version? Or is this not possible? I ended up getting mine sort of close to the desktop version upon stretching of the browser window but it is not really close to the mobile height dimension at all once you narrow it. Or will I learn to be better at this once I go along?

I am consistently struggling with margins, padding, and borders. I feel like if I change one it moves everything in the wrong direction so I will definitely need more practice with other challenges to get those fully understood.

Thanks to all those following me along :).

Community feedback

@Ambe-Mbong-Nwi

Posted

Hello, I love your work. To specify the width using the desktop-first approach, in the body include the max width given in the style sheet

body{
    max-width: 1440px;
    margin: 0 auto;
}

Later on, when modifying the styles for the mobile display, use the media query and specify the width of the mobile device there

/*mobile design styles*/
@media (max-width: 375px){
    body{
        max-width: 375px;
        margin: 0 auto;
    }

Note: The "margin: 0 auto" is used to centralize your page on every screen both vertically and horizontally so it's necessary you include it in your work

-Margins are used to create space around elements, outside of any defined borders.

-Padding is used to create space around an element's content, inside of any defined borders.

-The CSS border properties allow you to specify the style, width, and color of an element's border.

Please check out the link CSS Margin - W3 Schools for more information about how they are used.

Marked as helpful

1
Precious 490

@2peagles

Posted

Looks perfect, the code is very easy to read the only thing I noticed was the h1 you can put a spam inside of that and change the color like that instead of doing h1 h1 h1 just to save a few lines of coding. I swear for a week of coding this is really good, I was all over the place 😂 I think I probably still am I started using grid and took Kevin Powell's responsive course. I feel like maybe if you try the calc property for paddings that might work. Hope that was helpful.

Marked as helpful

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