Responsive qr link page using HTML and CSS. No JavaScript
Design comparison
Solution retrospective
My understanding of positioning is that relative position will be the parent element for all absolutely positioned elements when nested. For some reason, this didn't seem to help me so I went without positioning in a wrapper div. In hindsight, maybe I didn't need the wrapper div, but I wanted a way to add padding while also aligning center.
I may go back and update that without using the initial wrapper.
Community feedback
- @hyrongennikePosted about 2 years ago
Hi @mshaynerush,
Congrats on completing the challenge Jus a few suggestion you can replace the rule on the body with following to center the card the page.
body { background: var(--body-bg); margin: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; min-height: 100vh; }
this will center the card in the middle of the page. But because you used
position: absolute
you need to remove the following declarations..wrapper { /* position: relative; */ /* top: 5em; */ /* bottom: 100px; */ background: var(--wht); padding: 20px; /* width: fit-content; */ /* height: fit-content; */ /* margin: auto; */ border-radius: 20px; box-shadow: 0 0 10px rgba(0, 0, 0, .1); /* display: block; */ } .attribution { font-size: 11px; text-align: center; margin-top: 2rem; /* position: absolute; */ /* top: 55em; */ /* left: 50%; */ /* transform: translateX(-50%); */ }
everything with /.../ remove it completely. Hope these are helpful, let me know if you have any other questions.
Marked as helpful1 - @correlucasPosted about 2 years ago
👾Hello Shayne Rushton, congratulations for your new solution!
🎯 Your solution its almost done and I’ve some tips to help you to improve it:
Your component is done and the ccode is working, but the html markup/structure can be reduced by removing unnecessary divs, all you need is a single
<main>
or<div>
to keep all the content inside, and nothing more. The ideal structure is thediv
and only the image, heading and paragraph.Here’s a minimal html structure for this challenge:
<body> <main> <img src="./images/image-qr-code.png" alt="Qr Code Image" > <h1>Improve your front-end skills by building projects</h1> <p>Scan the QR code to visit Frontend Mentor and take your coding skills to the next level</p> </main> </body>
Here’s a good guide for writing a concise and clean code: https://altcampus.school/posts/writing-semantically-correct-and-clean-html
✌️ I hope this helps you and happy coding!
1@mshaynerushPosted about 2 years ago@correlucas Dude, this is so cool. I didn't realize this website would also be a means to get helpful tips. Thank you. I concur with your take and I will make that adjustment. Thank you for taking the time!
1
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