Design comparison
Solution retrospective
I built this project using HTML and CSS.. I'm studying development... Feedback welcome! ^^
Community feedback
- @MelvinAguilarPosted almost 2 years ago
Hello there π. Good job on completing the challenge !
I have some suggestions about your code that might interest you.
- It's generally not recommended to use the
overflow: hidden
property on the <body> element because it can cause unexpected behavior and make it difficult to access parts of the website
-
Using
height: 100vh
for the body element can cause problems with the layout of the page on smaller screens, such as in landscape view on a mobile device.On smaller screens, such as in landscape view on a mobile device, the height of the viewport may be less than the height of the content of the page. In this case, using height: 100vh for the body element will cause the content of the page to be hidden behind the body element.
Here is an image of how it would look on a mobile device: screencapture-nicoletsingas-github-io-Product-preview-card
To avoid this problem, it is generally recommended to use
min-height: 100vh
instead ofheight: 100vh
for the body element. This will ensure that the content of the page is always visible.
-
You can use the
<picture>
tag when you have different versions of the same image πΌ. Using the<picture>
tag will help you to load the correct image for the user's device saving bandwidth and improving performance. You can read more about this here π.Example:
<picture> <source media="(max-width: 460px)" srcset="./images/image-product-mobile.jpg"> <img src="./images/image-product-desktop.jpg" alt="{your alt text goes here}"> </picture>
- For specificity reasons you should work with classes instead of ids because they are more reusable. You can use ids to work with JavaScript, but you should use classes to style your elements. You can read more about this here π.
I hope you find it useful! π Above all, the solution you submitted is great!
Happy coding!
Marked as helpful0 - It's generally not recommended to use the
- @HassiaiPosted almost 2 years ago
wrap the old-price in <s><del> for those using screen readers to know of the old price.
<s><del>$169.99</del></s>
.To center #product on the page, add min-height:100vh; display: flex; align-items: center: justify-content: center; or min-height:100vh; display: grid place-items: center to the body.
To center #product on the page using flexbox: body{ min-height: 100vh; display: flex; align-items: center; justify-content: center; }
To center #product on the page using grid: body{ min-height: 100vh; display: grid; place-items: center; }
Use the colors that were given in the styleguide.md found in the zip folder you downloaded.
Use relative units like rem or em as unit for the padding, margin, width values and preferably rem for the font-size values, instead of using px which is an absolute unit. For more on CSS units Click here
Hope am helpful.
Well done for completing this challenge. HAPPY CODING
Marked as helpful0@MelvinAguilarPosted almost 2 years ago@Hassiai Hi! Use only one,
<del><s></s></del>
or<s><del></del></s>
is wrongThe del tag is used to indicate deleted text, and should not be used inside a s tag. The s tag is used to indicate text that is no longer accurate or relevant, but has not been deleted. With one of the two is enough.
Even so, the solution is excellent.
Marked as helpful1 - @caiomiyajiPosted almost 2 years ago
Really good job!
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