Design comparison
Solution retrospective
I am a beginner in web development, so any advice and criticism is welcome.
For the first website I built I think I did a solid job. I tried to make the website look as good as possible. I hope I was somewhat successful in that :).
If you have any questions for me, feel free to ask.
Community feedback
- @MelvinAguilarPosted almost 2 years ago
Hello there π. Good job on completing the challenge !
I have some feedback for you if you want to improve your code.
HTML π:
- 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>
-
Using a single tag instead of multiple tags can help to keep your code organized and easier to read. It also helps to reduce the amount of code that needs to be written, which can make it easier to maintain
Do:
<p>Scan the QR code to visit Frontend Mentor and take your coding skills to the next level</p>
Instead of:
<div class="explanation"> Scan the QR code to visit Frontend </div> <div class="explanation-2"> Mentor and take your coding skills to </div> <div class="explanation-3"> the next level </div>
Alt text π·:
- The
alt
attribute should not contain underscores or hyphens, it must be human readable and understandable.
-
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. π.
CSS π¨:
- Instead of using pixels in font-size, use relative units like
em
orrem
. The font-size in absolute units like pixels does not scale with the user's browser settings. This can cause accessibility issues for users who have set their browser to use a larger font size. You can read more about this here π.
- Centering an element with
position: absolute
would make your element behave strangely on some screen sizes, "there's a chance the content will grow to overflow the parent". You can use Flexbox or Grid to center your element. You can read more about centering in CSS here π.
body { min-height: 100vh; display: flex; justify-content: center; align-items: center; } .container { position: relative; width: 320px; min-height: 500px; background-color: #ffffff; border-color: #eee; border-radius: 20px; overflow: hidden; } .box { /* position: relative; */ /* top: 50%; */ /* left: 50%; */ /* transform: translate(-50%, 42%); */ /* width: 50%; */ /* width: 320px; */ /* height: 500px; */ /* background-color: #ffffff; */ /* border-color: #eee; */ /* border-radius: 20px; */ /* overflow: hidden; */ } .main { /* position: absolute; */ /* top: 50%; */ /* left: 50%; */ /* transform: translate(-50%, 1020%); */ } . . .
I hope you find it useful! π
Happy coding!
Marked as helpful0@4jdinPosted almost 2 years ago@MelvinAguilar Thank you very much, I appreciate your help and I will try to make my next code better with your solutions.
1 - Use the
- @4jdinPosted almost 2 years ago
Hello, I just want to inform you that I have fixed all the errors in the code and that you can now use it if you need it.
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