@Islandstone89
Posted
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.
@Srikathyayini
Posted
@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!