
Design comparison
Solution retrospective
I am most proud of figuring out how to connect Google Fonts and getting the margins and border-radius right despite being confused by Figma.
What challenges did you encounter, and how did you overcome them?I don't understand Figma well, and some of the values seem off. For example the border-radius for the card said 25%, but that was way too much and i landed on 2%.
What specific areas of your project would you like help with?I think I managed to get the font looking decent, but it doesn't feel perfect to me. I could use some guidance there.
Community feedback
- @skyv26Posted about 2 months ago
Hi @tcmaraist, 👋
Great job on the project so far! Below are a few suggestions to enhance the semantics, responsiveness, and readability of your code. Let’s walk through them one by one with simple examples for clarity:
1. Centering the Card to the Screen 🌟
Currently, the
card
class is centered usingmargin-top
, which doesn’t adapt well to different screen sizes. A better approach is to refactor thebody
CSS as follows:Refactored Code:
.body { background-color: #d5e1ef; display: flex; flex-direction: column; justify-content: center; align-items: center; font-family: "Outfit", serif; min-height: 100vh; /* Ensures the content fills the entire screen height */ } .card { height: auto; /* Let the content define the height */ width: 100%; /* Make the card fluid */ max-width: 320px; /* Maintain a maximum width for readability */ border-radius: 2%; background-color: white; display: flex; flex-direction: column; align-items: center; text-align: center; /* Fixed typo: tex-align -> text-align */ }
This change ensures the card is vertically and horizontally centered, even on smaller screens. Imagine reading a business card: you want it perfectly centered for easy focus.
2. Avoid Using Fixed Heights for the Card 🏗️
Setting a fixed
height
property limits flexibility. For instance, if you add more content or increase padding, the card might overflow. Instead, let the inner elements decide the height by using padding and margins.Refactored Code:
.card { padding: 20px; /* Add padding to manage spacing */ height: auto; /* Dynamic height adjustment */ width: 100%; max-width: 320px; /* Ensures responsiveness */ border-radius: 2%; background-color: white; display: flex; flex-direction: column; align-items: center; text-align: center; }
Think of this like resizing a box based on what you’re putting inside it — the box adjusts dynamically, rather than spilling over or leaving empty space.
3. Make the Card Responsive 🖥️
Using a fixed
width
(e.g.,width: 320px
) can break the layout on smaller or larger screens. Switching tomax-width
makes the card fluid and adaptive.Example:
On mobile devices, the card will shrink proportionally instead of staying fixed at
320px
.Refactored Code:
.card { width: 100%; /* Fluid width */ max-width: 320px; /* Restricts to a reasonable maximum */ }
4. Use Semantic Tags for Better Accessibility 🎯
The
p
tag is currently being used for the card’s main heading. Since it conveys the primary purpose of the card, anh1
,h2
, orh3
tag would be more appropriate. Semantic tags improve accessibility for screen readers and provide better document structure.Current Code:
<p class="card-title"> Improve your front-end skills by building projects </p>
Suggested Code:
<h2 class="card-title"> Improve your front-end skills by building projects </h2>
Imagine a search engine or screen reader trying to understand the card. Using an
h2
signals, "This is important content!" — just like a bold heading in a newspaper article.
Summary ✅
- Centering: Use
min-height: 100vh
for thebody
and removemargin-top
from thecard
. - Dynamic Height: Avoid fixed heights; let inner elements control the size.
- Responsiveness: Replace
width
withmax-width
. - Semantic Tags: Replace the
p
tag with a heading tag (h2
) for better accessibility and structure.
Keep up the great work, and feel free to reach out if you have any questions! 🚀
0 - Centering: Use
Please log in to post a comment
Log in with GitHubJoin 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