Design comparison
Solution retrospective
- Displaying different images for desktop and mobile version. Aligning the discounted price to the centered height of the price.
- None
- Any best practices method to align the discounted price to mid height of the price.
Community feedback
- @AdrianaMagdalenaPosted over 1 year ago
Hi there!
I can help with the alignment of the price, I solved it by using flexbox. You'd have to put both prices into a div container (let's give it a class of "flex-group" for this example), and set it's display to flex, then align the items to the center. With flexbox you can also set a nice gap between the prices too.
So the CSS would look like following:
.flex-group { display: flex; align-items: center; gap: 1rem; }
Hope that helps!
Marked as helpful0 - @timbosToursPosted over 1 year ago
hello friend,
In order to show/hide the different images for desktop and mobile you can use
display: none;
inside of a css media query. https://www.w3schools.com/cssref/css3_pr_mediaquery.phpAnd heres a great article I found about alignment. https://dev.to/venkyakshaya/the-ultimate-guide-to-center-align-css-2h9l
Hope that helps and Good Luck!
Marked as helpful0@Q8LPs6VsPosted over 1 year ago@timbosTours
Alternatively you can use the <picture> element for displaying a different image for desktop and mobile.
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