Responsive design page Parfume Shopping
Design comparison
Solution retrospective
I have found difficult to adapt different images for mobile and desktop versions with responsive way. Decision was to use background-images for div instead of direct <img>.
Community feedback
- @correlucasPosted about 2 years ago
πΎHello Alexey, congratulations for your new solution!
I saw that you've used
margins
to give the container its alignment, this works but is really tricky to control all the content. My advice for your is to useflexbox
to create this alignment. For example, first of all add to thebody
min-height: 100vh
to make the body display 100% of the browser screen size anddisplay: flex
eflex-direction: column
to align the child element (the container) vertically using the body as reference.Here's is your code with the fixes and also the correct size for the component that is
max-width: 900px
body { min-height: 100vh; max-width: 1110px; margin: 0 auto; font-family: 'Montserrat', sans-serif; background-color: hsl(30, 38%, 92%); font-size: 14px; width: 375px; color: hsl(212, 21%, 14%); display: flex; align-items: center; justify-content: center; }
Here's my solution for this challenge if you wants to see how I build it: https://www.frontendmentor.io/solutions/product-preview-card-vanilla-css-and-custom-hover-state-on-hero-85A1JsueD1
π I hope this helps you and happy coding!
Marked as helpful0@AG1965RadioHeadPosted about 2 years ago@correlucas thank you a lot. I will check your recommendatios. I just started frontend dev, so every advice is precios
1@correlucasPosted about 2 years ago@AG1965RadioHead We're hear for that, feel free to ask further questions.
0@AG1965RadioHeadPosted about 2 years ago@correlucas can you send me a link to your code. On the page you linked it's lead me to "dead end"
0@correlucasPosted about 2 years ago@AG1965RadioHead https://www.frontendmentor.io/solutions/product-preview-card-vanilla-css-and-custom-hover-state-on-hero-85A1JsueD1
0 - @ASH2001princePosted about 2 years ago
Hello Alexey Glazatov congratulations for your new solution! I have some tips for you if you dont mind
- Always the body selector should have a height value and as I saw in my projects I always used to put it
min-height: 100vh;
. - All the elements should have a
box-sizing: border-box;
to prevent the default margin and padding . - The body also should be aligned vertically you make it happen by doing this
display: flex; justify-content: center; align-items: center;
- I also did this project a couple days ago and I received a feedback that helped me a lots you can open my profile to chick on it.
** I hope you find my feedback helpful .**
Marked as helpful0@AG1965RadioHeadPosted about 2 years ago@ASH2001prince thanx a lot for your comments. I just started my education so every advice is priceless
1 - Always the body selector should have a height value and as I saw in my projects I always used to put it
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