Design comparison
Community feedback
- @MelvinAguilarPosted almost 2 years ago
Hi there 👋. Good job on completing the challenge ! I have some feedback for you if you want to improve your code.
As mentioned, you should use grid or flexbox to center it. The main problem I see is that you have taken your body as a component, not the whole screen. In fact, the body should occupy 100% of the width and height of the screen.
body { /* background: var(--WHITE); */ background: var(--LIGHT-GRAY); /* border-radius: 20px; */ /* margin: 15rem auto; */ /* max-width: 350px; */ text-align: center; min-height: 100vh; display: grid; place-items: center; } .container { padding: 1em; max-width: 320px; background: var(--WHITE); }
HTML:
- Instead of having many <span> elements you should have occupied a single element and it can be for example a paragraph:
<p>Scan the QR code to visit Frontend Mentor and take your coding skills to the next level</p>
- Use the
<main>
tag to wrap all the main content of the page instead of the<div>
tag. With this semantic element you can improve the accessibility of your page.
- You must use a level-one heading (h1) even though this is not a full-page challenge. You can create an '<h1>' element within your 'main' element that will be hidden visually but visible and readable by screen readers. The class "sr-only" hides content visually and here are the styles to copy. e.g.:
<h1 class="sr-only">QR Card Component</h1>
- The
alt
attribute should explain the purpose of the image. Uppon scanning the QR code, the user will be redirected to the frontendmentor.io website, so a betteralt
attribute would beQR code to frontendmentor.io
If you want to learn more about the
alt
attribute, you can read this article.I hope you find it useful! 😄 Above all, the solution you submitted is great!
Happy coding!
2 - @ManuelMadeira98Posted almost 2 years ago
An easy way to center the card would be using grid or flexbox. For example, adding:
body { display: grid; place-items: center; }
centers your card vertically and horizontally on the page, since
place-items
works as a shorthand foralign-items
andjustify-content
.Happy coding :)
2
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