@ecemgo
Posted
Some recommendations regarding your code that could be of interest to you.
If you want that this solution is responsive, I recommend some techniques without using media query for this solution but it's up to you whether you use it or not
- If you want to make the card centered both horizontally and vertically, you'd better add flexbox and
min-height: 100vh
to thebody
- For the color of the screen, you can use the recommended color in the body
body {
/* background-color: #b1c5d4; */
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
min-height: 100vh;
background-color: hsl(212, 45%, 89%);
}
- If you use flexbox in the body, you don't need to use flexbox and
margin
in the#card
to center the card, you can remove them to avoid repetition - If you use
max-width
instead ofwidth
andheight
, the card will be responsive - You'd better give
padding
to give a gap between the content and the border of the card
#card {
/* width: 280px; */
max-width: 280px;
/* height : 430px; */
/* margin: 0 auto; */
/* display: flex; */
/* flex-direction: column; */
/* justify-content: center; */
/* margin: 200px auto 5px auto; */
padding: 15px;
}
- 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%
andheight: 100%
for the img
.image-qr-code {
border-radius: 20px 20px 20px 20px;
/* padding: 15px; */
width: 100%;
height: 100%;
}
- Finally, you don't need to use media queries for this solution because the card will be responsive if you follow the steps above
Hope I am helpful. :)
Marked as helpful