@correlucas
Posted
👾Hello @Demyttenaere, congratulations for your new solution!
🎨 Here’s some tips to improve your component design:
You tried to align the component using margins
and position relative
but this make this task really tricky and hard control all the content. My advice for you is to use flexbox
to create this alignment. First thing you've to do is to add min-height: 100vh
to make sure your body will be displaying minimum 100% of the view-port height (this will help the card be ever aligned vertically centered) and then add display: flex; align-items: center; justify-content: center;
to make the alignment:
REMOVE ALL THE MARGINS TO MAKE THE CORRECT ALINGMENT:
.page1, .page2 {
background-color: hsl(213, 19%, 18%);
border-radius: 20px;
/* margin-top: 200px; */
/* margin-left: 15px; */
margin-right: 15px;
}
@media screen and (min-width: 1000px)
.page1, .page2 {
width: 350px;
/* margin: auto; */
/* margin-top: 200px; */
}
THE CORRECT ALIGNMENT:
body {
min-height: 100vh;
background-color: hsl(216, 12%, 8%);
font-family: 'Overpass', sans-serif;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
✌️ I hope this helps you and happy coding!
Marked as helpful
@Demyttenaere
Posted
Hi @correlucas,
Thank you for this comment, it will help me in my next challenges!
Good coding!