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

Product card component using CSS flexbox

@WitchDevelops

Desktop design screenshot for the Product preview card component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


I wonder what to do about the positioning of the footer, since I used position:absolute for the main card component it removed it from the document workflow, so I also used position: absolute on the footer. It creates an issue that if the page is viewed on mobile in landscape mode, the footer is in the middle of the screen. Any ideas how to fix it?

Community feedback

coderwww 220

@coderwww

Posted

You may try something like this instead of absolute positioning

body {
      min-height: 100vh;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: space-between;
      gap: 1rem;
    }
    main {
      position: static; /* removes position absolute*/
      transform: none;  /* removes transform*/
    }
    footer {
      position: static; /* removes position absolute*/
      margin: 0 !important; /* or remove class centered */
      justify-self: end;
    }

P.S. main will be centered in the free space above footer, so you will need some additional styling, for example margin to center it relative to screen height

And as for me, it would be better to start showing desktop view from min-width a little bit bigger then component width, not from exactly 1440px

Marked as helpful

0

@WitchDevelops

Posted

@coderwww thanks a lot! I'll try that :)

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