Design comparison
Solution retrospective
I'm proud of the fact that I attempted this challenge, and I learnt so much while at it.
What challenges did you encounter, and how did you overcome them?My only challenge was making the website responsive for mobile screens. It prove to be very difficult for me, sadly.
What specific areas of your project would you like help with?I would like help with the CSS to make the website responsive for mobile screens. I don't know where I got it wrong, it could be from the HTML code or the CSS but I know something is not right.
Community feedback
- @Alex-Archer-IPosted 5 months ago
Hi there!
I see you are using absolute positioning here. It's good for practice but not quite fit for this challenge =)
Also there not need to wrap every item in the container as
h1
,p
andimg
is block elements so you can style them directly.Basically in this case you need flex with two parts. For example it can be
main
tag or.container
- but don't forget that every page should containmain
tag for semantical reasons.<main> <img src="" alt=""/> <div className="content"> <p>PERFUME</p> <h1>Title</h1> <p>Description</p> ... </div> </main>
Sorry, I didn't rewrite everything, but I hope you understand in general =)
So, you set display of
main
to flex,img
and.content
will take a half of it's width and than you can style.content
as qr-code card in the previous challenge.Well, that's a main idea =)
Marked as helpful0@Macnelson9Posted 5 months ago@Alex-Archer-I Oh okay. I'll work on it using your method and give you a feedback on how it's going. Thank you so much.
1@Alex-Archer-IPosted 5 months ago@Macnelson9
There are often a few ways to achieve required result. Flex is just the easier one, and absolute positioning could be very unpredictable in various screen sizes =)
Alas, I didn't do this challenge, so I can't see the design template for mobile devises. But I see, that there is another picture for mobile screens and I can assume that it is located above the content. In that case you can change
flex-direction
oncolumn
in themedia
queries.You can change
img
source depending on the screen size viapicture
tag which containsimg
andsource
tags:<picture> <source srcset="mobile.jpg" media="(max-width: 400px)"> <img src="desktop.jpg" alt=""> </picture>
This element will check conditions of every
source
tag (they are similar tomedia
in css) and load image from it'ssrcset
. If none of the conditions match it'll load image from thesrc
ofimg
tag.Or, you can have two
img
tags and change theirdisplay
viamedia
, but semanticallypicture
tag will be better and a bit more professional =)Marked as helpful0@Macnelson9Posted 5 months ago@Alex-Archer-I Hey, thanks so much! I figured it out. Check out the new solution I submitted.
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