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 Component

#styled-components

@darrenohello

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


I put the img inside a div because when I first saw the designs I thought the blue background was stylistic and the QR code sat inside. I know I could have simply used the img tag itself, or even used a background image, but this seemed like it might be best practice. Is that right?

Any feedback on best practices would be great! Thank you.

Community feedback

Amos 470

@fistty

Posted

Congrats Darren, in my experience it's better to put images in a div, it makes it easier to give a max-width. Also, if the image is going to take up space such as this, it's better to make it an image and not a background. I also, noticed your first heading was h4, it's better to start with an h1. Again, well-done on this challenge.

Marked as helpful

1

@darrenohello

Posted

@fistty Thanks for the feedback, I appreciate it!

1
Lucas 👾 104,580

@correlucas

Posted

👾Hi Darren O'Hehir, congratulations for your first solution!👋 Welcome to the Frontend Mentor Coding Community!

The html structure is fine and works, but you can reduce at least 20% of your code cleaning the unnecessary elements, you start cleaning it by removing some unnecessary <div>. For this solution you wrap everything inside a single block of content using <div> or <main> (better option for accessibility) and put inside the whole content <img> / <h1> and <p>.

<body>
<main>
<img src="./images/image-qr-code.png" alt="Qr Code Image" >
 <h1>Improve your front-end skills by building projects</h1>
<p>Scan the QR code to visit Frontend Mentor and take your coding skills to the next level</p>
</main>
</body>

✌️ I hope this helps you and happy coding!

Marked as helpful

1

@darrenohello

Posted

@correlucas Thank you for the feedback, it's great to hear about better practices. I forgot about the <main> tag, I'll refresh my knowledge on what it's use case is!

1
Lucas 👾 104,580

@correlucas

Posted

@darrenohello Thats nice Darren! Keep posting amazing solutions here. Have a nice day =)

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