Design comparison
Solution retrospective
I was unsure if I got the spacing right on a desktop because "off-road" was wrapping at the hyphen, which was not happening in the example. I decided to add white-space: nowrap to a span around those two words in order to keep them on the same line. Does anyone see any spot where I went wrong that may have affected this or is this part of the solution?
Otherwise, I think I got it! Any feedback is always valued and appreciated, Thanks! Matt
Community feedback
- @danielmrz-devPosted 11 months ago
Hello Matt!
Your project looks great! Beautiful and responsive.
I have a tip that might help you:
- You can add
height: 100vh
to yourbody
tag on your desktop version. Doing that, you won't needmargins
to center the card.
Other than that, great job. Both desktop and mobile versions are perfect 👌🏼
0@Matt-LaRochellePosted 11 months ago@danielmrz-dev Hi Daniel,
I really appreciate your feedback, but I don't understand how this helps... If I add height:100vh to the body tag then when I shrink the window vertically on desktop, or when I look on a phone in a horizontal mode, it cuts off a lot of the main element. I think I prefer my own way as it works on all screens I tried it on. Please let me know though if I'm mistaking what you have written!
Thank you! Matt
1@danielmrz-devPosted 11 months agoHey @Matt-LaRochelle
Adding
height: 100vh
to thebody
tag along withdisplay: flex; flex-direction: column; place-items: center;
is a technique we use to center elements in the middle of the page without using margins.
This is not working for you because your
card
has amargin-top: 100px
and yourfooter
has amargin: 40px auto 15px;
.All those
margins
use space that was supposed to be occupied by your card. This is why it cuts off parts of your main element sometimes.0@Matt-LaRochellePosted 11 months ago@danielmrz-dev I see, thank you for your feedback! The place-items rule will definitely come in handy, I didn't know how that one works.
After making the changes, I still was running into the problem where if the window is vertically too short it won't let me scroll to see the rest of the card.
I found a solution though - on the main element I had used overflow: hidden in order to have the border radius working. I added overflow-y: scroll and now everything is working properly.
0 - You can add
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