@ecemgo
Posted
Some recommendations regarding your code that could be of interest to you.
HTML
- If you want to use the recommended font-family for this project, you can add the following between the
<head>
tags in HTML file:
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Outfit:wght@400;700&display=swap" rel="stylesheet">
CSS
- After adding them to the HTML, you can add this font-family to the
body
in CSS file: - In order to center the card correctly, you'd better add flexbox and
min-height: 100vh
to thebody
- You don't need to use
padding
for thebody
body{
font-family: 'Outfit', sans-serif;
/* padding-top: 70px; */
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
min-height: 100vh;
}
- If you use flexbox in the
body
, you don't need to usemargin
in the.div-center
to center the card - If you use
max-width
instead ofwidth
, it makes the card responsive
.div-center {
/* margin: auto; */
/* width: 20%; */
max-width: 300px;
}
- 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%
for the img in this way:
img {
display: block;
/* margin-left: auto; */
/* margin-right: auto; */
/* width: 90%; */
width: 100%;
border-radius: 5%;
}
- When this solution is in mobile and tablet size, the texts are not visible because you use
vw
for the font-size. Therefore, you can usepx
orrem
.
h3 {
/* font-size: 1.5vw; */
font-size: 1.5rem;
}
p {
/* font-size: 1vw; */
font-size: 1rem;
}
- You don't need to use media queries for this solution. If you update your code like above, the card will be responsive.
Hope I am helpful. :)
@yauwalu84
Posted
@ecemgo Thank you for the feedback. I will go through the process to implement and learn more.