Design comparison
Solution retrospective
Hi there!,
- If I don’t specify the height in px, top: X% with relative position doesn’t work. Is there any way I can specify height in % instead of hardcoding the value?
- I have specified overflow: hidden but can still see the scrollbars when I resize the window.
Community feedback
- @OmKakatkarPosted about 3 years ago
Hi,
Solution for Question 1 :
- Make sure you fix the 2nd problem first.
- Remove margin and width in the body tag if any
- Add the following to the div with class name "main"
max-width: 1000px; width: 40%; margin: 3rem auto;
Solution for Question 2:
- The body seems to have
overflow: hidden;
attached to it. Remove it. - Remove the
margin: 5%
in body as this is causing an overflow. The total width is getting calculated to 110% on x and y axes. - Once these 2 properties are removed from the body, the overflow still persists. This is due to the background images (top and bottom svg images) you have added in your card component. Instead of the
img
tag in html, you can set those images using CSS as follows:
body { background-image: url(../images/bg-pattern-top.svg), url(../images/bg-pattern-bottom.svg); background-repeat: no-repeat; background-position: right 50vw bottom 50vh, left 50vw top 50vh; background-color: var(--cyan); }
This will mostly solve your overflow issue
If you still don't understand, try to go through MY SOLUTION
PS : Just a heads up, use landmark tags instead of div everywhere. A quick start would be to convert the div with class "main" to a main tag instead
Happy Coding!!✨✨
Marked as helpful1@nayanabhatmPosted about 3 years ago@OmKakatkar Thanks for the detailed explanation. This is super helpful!
0 - @fidellimPosted about 3 years ago
Hi Nayana, I believe the reason why scrollbars appear is that you are setting margins on your body tag :
@media screen and (min-width: 1000px) body { /* margin: 20% 30%; */ }
With this, the whole page will really expand.
Marked as helpful1 - @Shahab-MalikkPosted about 3 years ago
Hi @Nayana great work implemented things well there is no issue in website
Keep Coding
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