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

Ryan Lim 10

@ryanlim-dev

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


What are you most proud of, and what would you do differently next time?

  1. Figuring out how adjust font-weight with Google variable fonts.
  2. Adding images to my site and getting them to load.

What challenges did you encounter, and how did you overcome them?

  1. Vertically aligning the QR code section.
  2. Horizontally aligning the QR code section.
  3. Implementing flexbox.
  4. Finding the correct adjustments for the box shadow of the QR code section.

What specific areas of your project would you like help with?

  1. Adjustments for the box shadow (the one I inserted does not look as subtle as the one in the example).

Community feedback

P
Steven Stroud 4,500

@Stroudy

Posted

Awesome job tackling this challenge! You’re doing amazing, and I wanted to share a couple of suggestions that might help refine your approach…

  • Wrapping a img on its own in a div in unnecessary and can confuse screen readers,
        <div class="image">
            <img src="./images/image-qr-code.png" alt="QR Code" class="qr-code">
        </div>
  • Using a <main> tag inside the <body> of your HTML is a best practice because it clearly identifies the main content of your page. This helps with accessibility and improves how search engines understand your content.

  • Using max-width: 100% or min-width: 100% is more responsive than just width: 100% because they allow elements to adjust better to different screen sizes. To learn more, check out this article: responsive-meaning.

  • Developers should avoid using pixels (px) because they are a fixed size and don't scale well on different devices. Instead, use rem or em, which are relative units that adjust based on user settings, making your design more flexible, responsive, and accessible. For more information check out this, Why font-size must NEVER be in pixels or this video by Kevin Powell CSS em and rem explained.- Another great resource for px to rem converter.

  • Line height is usually unitless to scale proportionally with the font size, keeping text readable across different devices. Best practice is to use a unitless value like 1.5 for flexibility. Avoid using fixed units like px or %, as they don't adapt well to changes in font size or layout.

  • Using a full modern CSS reset is beneficial because it removes default browser styling, creating a consistent starting point for your design across all browsers. It helps avoid unexpected layout issues and makes your styles more predictable, ensuring a uniform appearance on different devices and platforms, check out this site for a Full modern reset

You’re doing fantastic! I hope these tips help you as you continue your coding journey. Stay curious and keep experimenting—every challenge is an opportunity to learn. Have fun, and keep coding with confidence! 🌟

0

Ryan Lim 10

@ryanlim-dev

Posted

@Stroudy thank you for your reply, I'm a beginner coder so this really helps!

I just have a couple of questions:

  1. With the image, did you mean that I should just get rid of the <div> brackets and just leave the <img> part?
  2. In regards to using a full modern CSS, did you mean using the code below, or shoud I use all the code shown in the full modern reset article you linked?
.* {
margin: 0;
padding: 0;
height: 100%
}

2a. Should I use this in every web project I do as best practice?

1
P
Steven Stroud 4,500

@Stroudy

Posted

Hey @ryanlim-dev,

  1. An image (<img>) doesn't need to be wrapped in a <div> on its own because the <img> element is already a standalone, self-contained element. It can be styled, positioned, and manipulated directly without needing a parent container.

  2. When referring to "using a full modern CSS reset", it typically means applying a reset or normalization stylesheet that ensures consistency across browsers by resetting default styles.

  • Basic CSS Reset: This is a minimal reset to remove browser-specific styles, such as default margins and padding.
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
  • Full Modern CSS Reset: A more detailed reset, which may include additional rules for typography, form elements, and layout, based on a full reset.
*, *::before, *::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

body {
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
}

input, button, textarea, select {
  font: inherit;
}

p, h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
}

#root, #__next {
  isolation: isolate;
}

2a. 100% for consistency, You can use basic one for small solutions and a full reset for bigger ones, Why not just use the full one every time, That is what I have started to do.

Hope this clears up some of your questions.

0
P
Steven Stroud 4,500

@Stroudy

Posted

Hey @ryanlim-dev,

  1. An image (<img>) doesn't need to be wrapped in a <div> on its own because the <img> element is already a standalone, self-contained element. It can be styled, positioned, and manipulated directly without needing a parent container.

  2. When referring to "using a full modern CSS reset", it typically means applying a reset or normalization stylesheet that ensures consistency across browsers by resetting default styles.

  • Basic CSS Reset: This is a minimal reset to remove browser-specific styles, such as default margins and padding.
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
  • Full Modern CSS Reset: A more detailed reset, which may include additional rules for typography, form elements, and layout, based on a full reset.
*, *::before, *::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

body {
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
}

input, button, textarea, select {
  font: inherit;
}

p, h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
}

#root, #__next {
  isolation: isolate;
}

2a. 100% for consistency, You can use basic one for small solutions and a full reset for bigger ones, Why not just use the full one every time, That is what I have started to do.

Hope this clears up some of your questions.

0
MikDra1 6,400

@MikDra1

Posted

If you want to make your card responsive with ease you can use this technique:

.card {
width: 90%;
max-width: 37.5rem;
}

On the smaller screens card will be 90% of the parent (here body), but as soon as the card will be 37.5rem (600px) it will lock with this size.

Also to put the card in the center I advise you to use this code snippet:

.container {
display: grid;
place-items: center;
}

Hope you found this comment helpful 💗💗💗

Good job and keep going 😁😊😉

0

Ryan Lim 10

@ryanlim-dev

Posted

@MikDra1 appreciate your feedback!

Can I ask, what's the difference between flexbox and grid?

I'm just not really too sure which situation(s) to use either 😅

0
MikDra1 6,400

@MikDra1

Posted

@ryanlim-dev

It’s up to you 😉

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