
Design comparison
SolutionDesign
Solution retrospective
What challenges did you encounter, and how did you overcome them?
the landscape mode dont work that good
Community feedback
- @skyv26Posted about 2 months ago
Hi @basSluiter,
Here are a few suggestions to improve your code:
- Use
div
instead ofarticle
tag: Since this is a card layout project,article
isn't the most appropriate tag. A simplediv
will be more suitable for the structure.
<div class="article-container"> <img src="./assets/images/illustration-article.svg" alt=""> <div>learning</div> <p>Published 20 Jan 2025</p> <h2 class="active">HTML & CSS foundations</h2> <p>These languages are the backbone of every website, defining structure, content, and presentation.</p> <div class="publisher"> <img src="./assets/images/image-avatar.webp" alt=""> <h3>Greg Hooper</h3> </div> </div>
- Remove the
min-width
restriction: You already have amax-width
set, so themin-width
isn't necessary. This will make the card layout more fluid across screen sizes.
.article-container { display: flex; flex-direction: column; height: fit-content; justify-content: center; max-width: 25rem; /* Remove min-width */ border: solid 2px; box-shadow: 10px 10px; border-radius: var(--border-radius); background-color: var(--clr-sec); padding: 1.5rem; margin: 2rem 3rem; /* Shorthand margin */ }
- Remove the unnecessary media query: Since you're handling responsiveness through
max-width
, there's no need for the media query anymore. Removing it will simplify the code.
/* Remove the media query */ @media screen and (width > 375px) { .article-container { /* max-width: 25rem; */ } }
- Shorthand for margins: Instead of writing multiple margin properties, you can use shorthand for the
margin
property:
margin: 2rem 2rem 3rem;
- Add width
100%
to the image: To ensure the image is responsive, addwidth: 100%
to make it scale with the parent container.
img { width: 100%; }
Hope this helps! Let me know if you need further clarification. 😊
0 - 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