Stats preview card component solution using CSS Flexbox
Design comparison
Community feedback
- @0xabdulkhaliqPosted over 1 year ago
Hello there 👋. Congratulations on successfully completing the challenge! 🎉
- I have other recommendations regarding your code that I believe will be of great interest to you.
DECORATIVE iMAGE'S ♨️:
- The
alt
attribute is used to provide alternative text for images in HTML documents. Thealt
attribute is used by screen readers to describe the image to visually impaired users, which is essential for web accessibility.
- Now, when it comes to decorative
images
, they are used purely for aesthetic purposes and do not convey any important information or functionality to the user.
- Since these images do not convey any important information or functionality, there is no need for an
alt
attribute.
- So feel free to set the
alt
attribute as""
for decorativeimage's
, becausealt=""
will be skipped by screen readers they will consider the image as decoration
Example:
<img src="images/decorative.jpg" alt="">
<img src="images/image-header-mobile.jpg" alt="card image" class="card-img"> 👇 <img src="images/image-header-mobile.jpg" alt="" class="card-img">
.
I hope you find this helpful 😄 Above all, the solution you submitted is great !
Happy coding!
Marked as helpful1 - @HassiaiPosted over 1 year ago
There is no need to give the main a padding value, to center .card on the page using flexbox or grid instead of giving the main a padding value:
- USING FLEXBOX: add min-height:100vh; display: flex; align-items: center: justify-content: center; to the body
body{ min-height: 100vh; display: flex; align-items: center; justify-content: center; }
- USING GRID: add min-height:100vh; display: grid place-items: center to the body
body{ min-height: 100vh; display: grid; place-items: center; }
For a responsive content, give .card a width of 80vw or a max-width of 1440px and width of 80%.
For the color of the image, give .img a background-color of soft violet and give the img a width and height of 100%, object-fit: cover, mix-blend-mode: multiply and opacity: 0.8.
.img{ background-color: hsl(); } img{ width: 100%; height: 100%; object-fit: cover; mix-blend-mode: multiply; opacity: 0.8; }
Hope am helpful.
Well done for completing this challenge. HAPPY CODING
Marked as helpful1 - @heisemmaco-devPosted over 1 year ago
Hello there 👋. Congratulations on successfully completing the challenge! 🎉
I have other recommendations regarding your code that I believe will be of great interest to you. CSS: I WILL LIKE TO GO STRAIGHT TO THE POINT your images look more of white you can correct this by making the background color of the image div purple and then apply this property to the div: "background-blend-mode: multiple;"
secondly, your image shrink with the whole card, i took a look that your code an saw that your use the source tag to set you image media quire, that good acually but you have to use only one instead of setting two source code at your picture tag
I hope you find this helpful 😄 Above all, the solution you submitted is great !
Marked as helpful1
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