Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Simple Responsive QR code component

@NourElDinEmad

Desktop design screenshot for the QR code component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


Do you have any questions about best practices?

Community feedback

Abdul Khaliq πŸš€β€’ 72,660

@0xabdulkhaliq

Posted

Hello there πŸ‘‹. Congratulations on successfully completing the challenge! πŸŽ‰

  • I have other recommendations regarding your code that I believe will be of great interest to you.

CSS 🎨:

  • Let me explain, How you can easily center the component for better layout without usage of absolute positioning.
  • We don't need to use absolute to center the component both horizontally & vertically. Because using `absolute' will not dynamical centers our component at all states
  • To properly center the component in the page, you should use Flexbox or Grid layout. You can read more about centering in CSS here πŸ“š.
  • For this demonstration we use css Grid to center the component
body {
    min-height: 100vh;
    display: grid;
    place-items: center;
}
  • Now remove these styles, after removing you can able to see the changes
.card {
   position: absolute;
   top: 50%;
   left: 50%;
   transform: translate(-50%,-50%);
   margin: auto;
}
  • Now your component has been properly centered

HTML 🏷️:

  • This solution lacks semantic markup, which causes lacking of landmark for a webpage and allows accessibility issues to screen readers, due to accessibility errors our website may not reach its intended audience, face legal consequences, and have poor search engine rankings, highlighting the importance of ensuring accessibility and avoiding errors.
  • What is meant by landmark ?, They used to define major sections of your page instead of relying on generic elements like <div> or <span>. They are use to provide a more precise detail of the structure of our webpage to the browser or screen readers
  • For example:
    • The <main> element should include all content directly related to the page's main idea, so there should only be one per page
    • The <footer> typically contains information about the author of the section, copyright data or links to related documents.
  • So resolve the issue by replacing the <div class="card"> element with the semantic element <main> along with <div class="attribution"> with <footer> element in your index.html file to improve accessibility and organization of your page

.

I hope you find this helpful πŸ˜„ Above all, the solution you submitted is great !

Happy coding!

Marked as helpful

0
Talissonβ€’ 190

@talissoncosta

Posted

Hello @NourElDinEmad

First of all, congrats for your solution. I've got some tips for your:

  1. Use semantic tags. You should use the tag main to wrap up your solution.
  2. Use a h1 instead of a h3. It will help screen readers to understand where is the title.
  3. Avoid using tag name on your styles. Although it works, it is not a good practice. Use classes or ids instead.
  4. Border-radius does not seem to be accurate, you are using 10px for the img and the card. Nevertheless, on the designs the border radius for the image seems to be less than it is on the card.
  5. Try to explore flexbox in your next projects. As soon as you get used to it you will see how it is helpful, you will write a better code, more concise and easier to manage.

I hope it helps Happy coding! :D

Marked as helpful

0

Please log in to post a comment

Log in with GitHub
Discord logo

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