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

Basic CSS and a DIV

@brandonetter

Desktop design screenshot for the QR code component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Community feedback

Lucas 👾 104,420

@correlucas

Posted

👾Hi , congratulations on your solution!👋 Welcome to the Frontend Mentor Coding Community!

Great solution and a great start! From what I saw you’re on the right track. I’ve few suggestions for you that you can consider adding to your code:

  • Replace the <span> containing the main title with <h1> note that this title is the main heading for this page and every page needs one h1 to show which is the most important heading. Use the sequence h1 h2 h3 h4 h5 to show the hierarchy of your titles in the level of importance, never jump a level.
  • Add a margin of around margin: 20px to avoid the card touching the screen edges while it scales down.
  • Prefer CLASS instead of ID to give style to your elements, choosing id is not a good idea because it’s a too specific selector and it's better to use it for forms or Javascript code. It is not advisable to use IDs as CSS selectors because if another element in the page uses the same/similar style, you would have to write the same CSS again.

Here's my solution for this challenge if you wants to see how I build it: https://www.frontendmentor.io/solutions/qr-code-component-vanilla-cs-js-darklight-mode-nS2aOYYsJR

✌️ I hope this helps you and happy coding!

0

@brandonetter

Posted

@correlucas Hey thanks for the tips!

I agree with maybe your second point. But I have issues with these:

Replace the <span> containing the main title with <h1> note that this title is the main heading for this page and every page needs one h1 to show which is the most important heading.

I interpreted this design to be a COMPONENT (as it is named in the challenge), and as such I followed standard practices for adjusting text sizes as noted by MDN, using CSS font-size to adjust text size instead of using Headings.

As it is obviously meant to be incorporated into designs using a framework like React, an H1 tag would break best practices as there would likely already be a heading in the page that this component is used for.

As for this point: Prefer CLASS instead of ID to give style to your elements, choosing id is not a good idea because it’s a too specific selector and it's better to use it for forms or Javascript code. It is not advisable to use IDs as CSS selectors because if another element in the page uses the same/similar style, you would have to write the same CSS again.

I did not use an ID for any selector on this design.

Regarding your design- it is very pretty.

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