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 using Flexbox

@Malarpit16

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?

I like to believe that this project helped me improve my flexbox skills.

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

I had a great deal of trouble centering the QR Code on the page as well as the QR Code image on the component itself. To solve my troubles I went onto CodePen and just did trial and error till I figured it out.

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

I had created a flex container called "qr-code-container" which inside had a div called "qr-code". I set the body height to 'min-height: 100vh' and the height of "qr-code-container" to "height: 100%". However when I tried to center my QR Code with 'align-items: center' nothing happened. If the body height is the height of the viewport and "qr-code-container" is 100% the height of its container i.e. the body, why didn't 'align-items: center' do anything?

Community feedback

P
Steven Stroud 8,820

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

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

  • Having a clear and descriptive alt text for images is important because it helps people who use screen readers understand the content, making your site more accessible. It also improves SEO, as search engines use alt text to understand the image's context, helping your site rank better, Check this out Write helpful Alt Text to describe images,

  • 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

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

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

  • For future project, You could download and host your own fonts using @font-face improves website performance by reducing external requests, provides more control over font usage, ensures consistency across browsers, enhances offline availability, and avoids potential issues if third-party font services become unavailable. Place to get .woff2 fonts

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! 🌟

Marked as helpful

0

@Malarpit16

Posted

@Stroudy Hi I have a question related to GitHub. Initially when I would view my webpage with GitHub pages the QR Code image would not appear. I was told I needed to change my file path "images/image-qr-code.png" to just "image-qr-code.png". Does this mean that every time I use VSCode to make a webpage and then add it to a GitHub repository I have to change the file paths ? I'm assuming I am just doing this incorrectly though.

0
P
Steven Stroud 8,820

@Stroudy

Posted

Hey @Malarpit16, So yeah the difference is absolute file path vs relative file path, GitHub uses relative file path, So if your image is in the images folder, You would do this ./images/image-qr-code.png using ./

0
MikDra1 6,650

@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 😁😊😉

Marked as helpful

0

@Obasola-Emmanuel

Posted

I also tried using align-items but it didn't work so I ended up using margin

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