Qr componente

Solution retrospective
I am still struggling with css centering of img, padding, what I was trough trial and error, so if there is any formula for it, ill be grateful.
I think my code is a bit messy, if there is any suggestion to clear it i'll gladly take it
Please log in to post a comment
Log in with GitHubCommunity feedback
- @correlucas
👾Hi Marcos, congratulations for your first solution!👋 Welcome to the Frontend Mentor Coding Community!
Great solution and great start! By what I saw you’re on the right track. I’ve few suggestions to you that you can consider to add to your code:
Something I've noticed in your code is that in many occasions you've added some
<div>
to wrap contents that don't really need to be inside of a div block. Note that for this challenge all you need is a single block to hold all the content, can be<div>
or<main>
if you want to use a semantic tag to wrap the content, the cleanest structure for this challenge is made by a block of content with div/main and all the content inside of it (img, h1 and p) without need of any other div or something. See the structure below:<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>
✌️ I hope this helps you and happy coding!
Marked as helpful - @hyrongennike
Hi @Toxgem,
Nice job on your first attempt of the challenge
You can center the card by adding the following.
main { display: flex; flex-direction: column; justify-content: center; align-items: center; min-height: 100vh; }
Remove the
position: absolute
on .outer you can't use flexbox on elements withposition: absolute
. Remove theheight: 21.5rem
on the .outer.There are better ways to align and position than using
position: absolute
like flexbox and grid.Hope this is helpful
Marked as helpful
Join 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