QR Code Component Challenge in HTML and CSS
Design comparison
Solution retrospective
Looking to learn about frontend best practices so any feedback is welcome.
- What things could be better in the HTML file?
- What things could be better in the CSS file?
Community feedback
- @dusan-bPosted about 2 years ago
Hi Jennifer,
I just had a look at your code, most of it looks pretty good. There are just a few changes I would consider.
To center the card in both directions, a better way is to use Grid or Flexbox instead of
position
andtransform
:body { display: grid; place-content: center; min-height: 100vh; }
For
.card-container
it's better to usemax-width
instead ofwidth
as it prevents horizontal scrolling on small screens.As far as accessibility is concerned, alternative texts for images should have a clear message. Instead of "QR code", it would be better to have "Scan this QR code to improve your front-end skills".
Furhtermore, you should avoid skipping heading tags. The most important heading should always be
<h1>
, the second<h2>
etc.It's also important to use semantic section elements to allow browsers, assistive software and search engines to understand the structure of your web page. One of the most common ones is the
<main>
element that contains the main content of a page. Therefore, every web page needs to have a single<main>
element. In your case, the card component needs to be wrapped inside<main>
. You can easily do this by replacing the parentdiv
tag withmain
.I hope I could help. Keep up the good work, and happy coding. :)
Marked as helpful1
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