product-preview-card-component-main using HTML and CSS
Design comparison
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.
HTML ๐:
- Wrap the page's whole main content in the
<main>
tag.
- The
<h1>
is the most important heading on the page, In this challenge the perfumer's name can be considered like the title of the page, so it should be the<h1>
- The <br> tag is often used to create line breaks, but it doesn't convey any semantic meaning. When a screen-reader reads the text, it will break the flow of reading at the line break tag, which can be confusing for users. More information here.
- Avoid using uppercase text in your HTML because screen readers will read it letter by letter. You can use the
text-transform
property to transform the text to uppercase in CSS.
-
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. 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>
- Unfortunately, your solution is not adapted for mobile devices :(, you should use media query to change the design of the solution, you can even learn mobile first approach so that the solutions are completely responsive.
I hope you find it useful! ๐ Above all, the solution you submitted is great!
Happy coding!
1 - Wrap the page's whole main content in the
- @HassiaiPosted almost 2 years ago
Replace <div id="container"> with the main tag, the first <h3> with <h1> and the second<h3> with <h2> to dix the accessibility issues. click here for more on web-accessibility and semantic html
To center #container 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 #container on the page using flexbox: body{ min-height: 100vh; display: flex; align-items: center; justify-content: center; }
To center #container on the page using grid: body{ min-height: 100vh; display: grid; place-items: center; }
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
0@HannTosinPosted almost 2 years ago@Hassiai thank you. your observations were most helpful
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