@ecemgo
Posted
Some recommendations regarding your code that could be of interest to you.
- If you want to make the card centered both horizontally and vertically, you'd better add flexbox and
min-height: 100vh
to the body
body{
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
min-height: 100vh;
}
- When you use flexbox in the body, you don't need to use flexbox and
margin-top
in themain
to center the card - If you use max-width, the card will be responsive
main {
/* width: 18%; */
max-width: 300px;
/* margin-top: 100px; */
}
- In addition to that above, in order to make the card responsive and the image positioned completely on the card, you'd better add
width: 100%
to the img
img {
width: 100%;
/* height: 250px; */
/* width: 250px; */
border-radius: 10px;
}
- Finally, if you follow the steps above, the solution will be responsive.
Hope I am helpful. :)
Marked as helpful
@VishRoy
Posted
@ecemgo Thank you for your suggestions. It is really helpful.