Design comparison
Solution retrospective
Long time with no submited challenges. Decided to take this one for the warm-up.
Community feedback
- @correlucasPosted about 2 years ago
👾Hello Vahe Abovyan, Congratulations on completing this challenge!
I like the work you’ve done here, your solution is almost complete. I’ve some suggestion for you to improve the code/design:
1.I saw that you’ve used
flexbox
to place the content and create the layout. I think the best way to build this component with two columns is by usingGRID LAYOUT
since it is simpler to manage the columns and then create the media query for mobile. Here’s the steps to create it withgrid
create the main block to hold all the content (you can use<main>
to wrap), set itswidth
asmax-width: 900px
(it's the container size) anddisplay: grid
/grid-template-column: 1fr 1fr
(this means that your component will have two columns with 50% of the container width each thats 450px). To manage the column with the text use flexbox andgap
to give it the spacing between the texts or usepadding-bottom
to separate them. Then to create the mobile version, all you need to do is to change the container flow vertically withgrid-template-column: 1fr
.2.Use the tag
<picture>
to wrap the product image inside 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
3.Use units as
rem
orem
instead ofpx
to improve your performance by resizing fonts between different screens and devices. These units are better to make your website more accessible. REM does not just apply to font size, but to all sizes as well.✌️ I hope this helps you and happy coding!
Marked as helpful0
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