Design comparison
Solution retrospective
I feel as though my CSS could be a lot more concise, if anyone has any notes or suggestion please do share.
Community feedback
- @correlucasPosted about 2 years ago
👾Hello Roman, Congratulations on completing this challenge!
Your solution its almost done and I’ve some tips to help you to improve it:
A better way to work this solution image, the product image is by using
<picture>
to wrap it on the html instead of using it as<img>
orbackground-image
(with the css). Using<picture>
you wrap both images (desktop and mobile) and have more control over it, since you can set in the html when the images changes setting the screen size for each image.ote that for SEO / search engine reasons isn’t a better practice import this product image with CSS since this will make it harder to the image.Here’s the documentation and the guide to use this tag:
https://www.w3schools.com/tags/tag_picture.asp
See the example below:
<picture> <source media="(max-width:650px)" srcset="./images/image-product-mobile.jpg"> <img src="./images/image-product-desktop.jpg" alt="Gabrielle Parfum" style="width:auto;"> </picture>
✌️ I hope this helps you and happy coding!
0 - @VCaramesPosted about 2 years ago
Hey @r0mankeys, some suggestions to improve you code:
-
The background color needs to be applied to the Body Element.
-
When using images that are different size for different breakpoints, its’ far more effective to use the <picture> element. By using this element not only are able to use different size images, you can also save on bandwidth, meaning your content loads faster.
Syntax:
<picture> <source media="(min-width: )" srcset=""> <img src="" alt=""> </picture>
More Info:
https://www.w3schools.com/html/html_images_picture.asp
https://web.dev/learn/design/picture-element/
-
The Alt Tag in the image needs to be more descriptive. You want to describe what the image is; they need to be readable. Assume you’re describing the image/icon to someone.
-
"Gabrielle Essence Eau De Parfum" needs to wrapped in an <h1> Heading. Its the most important part of the card.
-
Remove all the **<br> elements you added to the heading. This would be annoying to someone who uses a screenreader hearing "break", "break", etc... over and over.
-
The Article Elements are being used incorrectly, they are not needed for this challenge.
-
The old price isnt being announce properly to screenreaders. You want to wrap it in a Del Element and include a sr-only text explaining that this is the old price.
-
Your CSS Reset is extremely small, you want to add more to it. Here are few CSS Resets that you can look at and use to create your own CSS Reset or just copy and paste one that already prebuilt.
https://www.joshwcomeau.com/css/custom-css-reset/
https://meyerweb.com/eric/tools/css/reset/
http://html5doctor.com/html-5-reset-stylesheet/
- To make you content accessible to your users, it is a best to use rem/em instead of px for your CSS property values. For media queries, I definitely suggest using em for them. By using px your assuming that every users browser (mobile, tablet, laptop/desktop) is using a font size of 16px (this is the default size on browser). Em's will help with users whose default isn't 16px, which can sometimes cause the your content to overflow and negatively affect your layout.
More Info:
https://betterprogramming.pub/px-em-or-rem-examining-media-query-units-in-2021-e00cf37b91a9
Happy Coding!
0 -
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