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

QR Code with HTML and CSS

@TwixGamer00

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


  • Is there anything i used that i shouldn't use inside my CSS?

Community feedback

Elijah 320

@taco-neko

Posted

I noticed you're using absolute positioning to center items while also having a display of flex and using justify-content. It's a bit redundant, and you should just use one or the other (I'd recommend flex). Or remove all of that and just use margin: auto.

This part of your code caught my attention:

.attribution {
  font-size: 11px;
  text-align: center;
  position: absolute;
  bottom: 0;
  font-size: 1em;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 15px;
}

You set a font-size of 11px and then overwrote it with 1em. I'm not sure if this was intentional. Also again, you could center this with margin: 0 auto 15px or margin: 15px auto instead of absolute positions.

Marked as helpful

1

@TwixGamer00

Posted

@taco-neko Hi,

The double font-size wasn't intented, I've removed it.

Can you explain me which parts I should remove and which I should keep or change, to prevent using both justify-content and flex?

0
Elijah 320

@taco-neko

Posted

@TwixGamer00 Remove everything related to the centering that you have used. In this case that means remove the position: absolute, all the top left bottom right properties, and the transform. Then also remove display: flex, flex-direction, justify-content, and align-items. Replace all of this with a simple margin: auto.

Simplicity is best when it comes to things like this in CSS. Also, absolute positioning can have unintended effects such as things going out of bounds.

I've also noticed you use pixel values a lot. I suggest using rems instead. See this video.

Also, never set a font-size in ems unless you know what you are doing. Use rems. See this video for an explanation.

Marked as helpful

1

@TwixGamer00

Posted

@taco-neko

I changed all units to Rem! Also removed the position: absolute and top left bottom, etc. Although i did keep the position absolute on the footer.

Thanks for your feedback!

1

@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.

HTML 🏷️:

  • This solution generates accessibility error reports, "All page content should be contained by landmarks" is due to non-semantic markup, which causes lacking of landmark for a webpage
  • So fix it by replacing the <div class="container"> element with the semantic element <main> along with <div class="attribution"> into a <footer> element in your index.html file to improve accessibility and organization of your page.
  • 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.

.

I hope you find this helpful 😄 Above all, the solution you submitted is great !

Happy coding!

Marked as helpful

1

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