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

I used margin, padding, text-align, border, border-radius, width.

amirbek887ā€¢ 30

@amirbek887

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

Hassia Issahā€¢ 50,670

@Hassiai

Posted

Replace <div class="qr-code"> with the main tag to fix the accessibility issues. click here for more on web-accessibility and semantic html

Give the body a background-color. To center .qr-code on the page using flexbox or grid instead of margin, add min-height:100vh; display: flex; align-items: center: justify-content: center; or min-height:100vh; display: grid place-items: center to the body.

USING FLEXBOX:
body{
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
USING GRID:
body{
min-height: 100vh;
display: grid;
place-items: center;
}

For a responsive content, replace the width in .qr-code with max-width and increase its value and the padding valu. max-width: 320px padding:16px. Give the img a max-width of 100% for a responsive image instead of a width.

Give h1 and p the same font-size of 15px which is 0.9375rem and the same margin-left, margin-right and margin-top values. Give p a margin bottom value and a font-color of hsl(212, 45%, 89%).

There is no need to give .qr-code a border value. give it a background-color of white. Use the font-family that was given in the styleguide.md in the zip folder you downloaded.

Use relative units like rem or em as unit for the padding, margin, width values and preferably rem for the font-size values, instead of using px which is an absolute unit. For more on CSS units Click here

Hope am helpful.

Well done for completing this challenge. HAPPY CODING

Marked as helpful

1
safdarā€¢ 130

@sfdrk

Posted

Hey šŸ‘‹ These are my suggestions ... To center .qr-code you can add min-height:100vh; display: flex; align-items: center: justify-content: center; or min-height:100vh; display: grid place-items: center to the body. The style will become like this

body{ min-height:100vh; display:grid; place-items:center;}

or

body{ min-height:100vh; display:flex; justify-content:center; align-items:center; }

margin-left and margin-right auto is ok when you want to center horizontally.

Then instead of only width you can add max-width for qr-code block wont go out of flow it will stay relatively to your screen size .. try adding that and check for the difference.The style will be like this

qr-code{ max-width:220px; width:100%; }

You also didn't add proper given font-family you can find fonts on google fonts.They are already mentioned too. (https://fonts.google.com/)

šŸ˜Š

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