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

Mwakambaโ€ข 10

@Sanderson-Nyange

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 encountered challenges in implementing the media screen sizes using CSS. I would appreciate being assisted with that.

Community feedback

Lucas ๐Ÿ‘พโ€ข 104,420

@correlucas

Posted

๐Ÿ‘พHi @Sanderson-Nyange, 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:

  • Something that can be a time saver for you is to use a CSS RESET to remove all default settings for margins, making the images easier to work, see the article below where you can copy and paste this CSS code cheatsheet: https://piccalil.li/blog/a-modern-css-reset/
  • Use <main> instead of a simple <div> this way you improve the semantics and accessibility showing which is the main block of content on this page. Remember that every page should have a <main> block and that <div> doesn't have any semantic meaning.
  • Replace the <h3> 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.
  • Use relative units as rem or em instead of px to improve your performance by resizing fonts between different screens and devices. These units are better to make your website more accessible. REM does not just apply to font size, but to all sizes as well.

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!

Marked as helpful

0
Ojaswi Kumarโ€ข 180

@ojaswishivam

Posted

Hey @Sanderson-Nyange, here are some suggestions to improve your code:

  • auto is not a valid value for padding property, but you can use auto in margin property

  • The Alt Tag Description for the image needs to be improved upon. You want to describe what the image is; they need to be readable. Assume youโ€™re describing the image to someone.

  • You have import Google Fonts of weight 400 and 700 in your project, Here is an example of how you can do it:

 <link rel="preconnect" href="https://fonts.googleapis.com">
 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
 <link href="https://fonts.googleapis.com/css2? 
   family=Outfit:wght@400;700&display=swap" 
   rel="stylesheet">

The Media Query used by me:

@media only screen and (max-width:629px)

Happy Coding! ๐Ÿ‘ป๐ŸŽƒ

Marked as helpful

0

@MelvinAguilar

Posted

Hi @Sanderson-Nyange ๐Ÿ‘‹, good job completing this challenge, and welcome to the Frontend Mentor Community! ๐ŸŽ‰

Here are some suggestions you might consider:

  • Extract all selectors and remove media queries, in this challenge there is no need to implement a media query to.
  • Add descriptive text to the alt attribute of the images. The text must clearly describe the image. The alt attribute enables screen readers to read the information about on-page images and will be displayed instead if an image file cannot load.
  • The container isn't centered correctly. You can use flexbox to center elements:

Links with more information:

.

With semantic tags:

<body>
   <main class="card">
      . . .
   </main>
   <footer class="attribution">
      . . .
   </footer>
<body>

In short, your styles should look like this:

body{
      /* Center with flexbox*/
     margin: 0;
      width: 100%;
      min-height: 100vh;
     display: flex;
     flex-direction: column;
     justify-content: center;
     align-items: center;

      background-color: hsl(212, 45%, 89%);
      font-family: 'Outfit', sans-serif;
      overflow: hidden;
}

img{
      width: 100%;
      border-radius: 10px;
}

.card{
      border-radius: 10px;
      background-color: hsl(0, 0%, 100%);
      max-width: 250px;
      min-height: 400px;
      padding: 14px;
      padding-bottom: 40px;
     /* margin-top:10% ;*/
      /*margin-left: 40%;*/
}

h3{
      font-weight: 700;
      text-align: center;
      font-size: 1.3em;
}

p{
      font-weight: 400;
      text-align: center;
      font-size: .9em;
}

.attribution { font-size: 11px; text-align: center; padding-top:4%;}
.attribution a { color: hsl(228, 45%, 44%); }

I hope those tips will help you.

Good job, and happy coding!

Marked as helpful

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