Design comparison
Solution retrospective
I'm proud of how the project achieves a clean, responsive design with only HTML and CSS, without relying on any external frameworks or libraries. The simplicity and scalability of the solution, particularly the way the card layout adapts to both mobile and desktop screens, is a key highlight. This approach ensures that users get a seamless experience on any device.Implement subtle animations, such as hover effects or smooth transitions when the card resizes, to improve the user experience and visual engagement.
What challenges did you encounter, and how did you overcome them?Ensuring that the card looked great on both mobile and desktop screens, especially with differences in font sizes, image scaling, and padding, was another challenge. The design needed to stay consistent without sacrificing readability or layout balance. I employed media queries to adjust the layout dynamically. By tweaking the font sizes, image dimensions, and container widths for different breakpoints, I was able to make the design responsive and visually appealing on both mobile and larger screens.
What specific areas of your project would you like help with?While I ensured that the design is responsive, I would like to improve its accessibility. Any tips or suggestions on how to make the card more inclusive, such as ARIA attributes or better color contrast choices, would be helpful.
Community feedback
- @Islandstone89Posted about 1 month ago
Hi there, well done.
Here are my suggestions - I hope they help!
HTML:
-
Every webpage needs a
<main>
that wraps all of the content, except for<header>
andfooter>
. This is vital for accessibility, as it helps screen readers identify a page's "main" section. Change the first<div>
into a<main>
. -
I would remove both the
<div>
that wraps the image, as well as the one wrapping the text, as they are not needed. -
The alt text must also say where it leads(the frontendmentor website). A good alt text would be "QR code leading to the Frontend Mentor website."
CSS:
-
It is best practice to write CSS in a separate file, often called
style.css
. Create one in the same folder as theindex.html
, and link to it in the<head>
:<link rel="stylesheet" href="style.css">
. -
Including a CSS Reset at the top is good practice.
-
Use the style guide to find the correct
font-family
, and remember to specify a fallback font:font-family: 'Outfit',sans-serif;
-
I recommend adding
1rem
ofpadding
on thebody
, to ensure the card doesn't touch the edges on small screens. -
On the
body
, changeheight
tomin-height: 100svh
- this way, the content will not get cut off if it grows beneath the viewport. -
Remove the styles on
.card-container
, they are not needed. -
Remove the
width
inpx
on the card. We rarely want to give a component a fixed size, as we want it to grow and shrink according to the screen size. -
We do want to limit the width of the card, so it doesn't get too wide on larger screens. To solve this issue, give the card a
max-width
of around20rem
. -
I would set
font-size
inrem
instead ofem
. -
On the image, add
display: block
andmax-width: 100%
- the max-width prevents it from overflowing its container. Without this, an image would overflow if its intrinsic size is wider than the container.max-width: 100%
makes the image shrink to fit inside its container. Remove theheight
inpx
. though you can setheight: auto
if you want. -
Using a selector like
.card-content h2
increases the specificity, which makes it harder to override. Instead, it's recommended to give elements a class and use that as the selector.
0@SrikathyayiniPosted about 1 month ago@Islandstone89
Thank you so much for your detailed and thoughtful feedback! I really appreciate the time you took to go through both the HTML and CSS aspects of my project. Your suggestions will be very helpful as I work on improving my code.
I’ll be sure to update the HTML by using the <main> tag to wrap the content for better accessibility, and I'll also simplify the structure by removing the unnecessary <div> tags around the image and text. The note about the alt text is incredibly useful—I'll update it to be more descriptive, such as "QR code leading to the Frontend Mentor website," which makes perfect sense.
Regarding the CSS, I agree with moving it into a separate style.css file for better organization and scalability. Including a CSS reset and utilizing the style guide's font-family along with a fallback is a great tip, and I’ll make sure to incorporate that. I also appreciate the reminder about padding on the body for small screens and changing height to min-height: 100svh. These adjustments will definitely help with responsiveness.
I’ll also make the changes you suggested regarding the card layout, such as removing fixed widths in pixels, adding max-width to prevent overflow, and ensuring that images don’t exceed their container by using display: block and max-width: 100%. I hadn't considered that using a class for headings instead of element selectors like .card-content h2 would reduce specificity issues, so I'll make that change to improve the maintainability of my CSS.
Thanks again for such actionable and clear advice—I'm excited to implement these improvements and make my project even better!
1 -
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