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-challenge using CSS grid

Aldrin Fernandezโ€ข 190

@aljager1983

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

@MelvinAguilar

Posted

Hello there ๐Ÿ‘‹. Good job on completing the challenge !

I have some suggestions about your code that might interest you.

HTML ๐Ÿท๏ธ:

  • Wrap the page's whole main content in the <main> tag.
  • Since this component involves scanning the QR code, the image is not a decoration, so it must have an alt attribute. The alt attribute should explain its purpose. e.g. QR code to frontendmentor.io

CSS ๐ŸŽจ:

  • You can center the component without using grid-template-columns, all you need to add is place-content: center and it will be centered. In this solution you don't have any other elements so it's not very suitable to use columns.
  • Use min-height: 100vh instead of height. Setting the height to 100vh may result in the component being cut off on smaller screens if you use place-content: center, such as a mobile phone in landscape orientation.

I hope you find it useful! ๐Ÿ˜„ Above all, the solution you submitted is great!

Happy coding!

Marked as helpful

2

Aldrin Fernandezโ€ข 190

@aljager1983

Posted

@MelvinAguilar thanks for the tip, tried out your suggestions its simpler than my previous one, and less lines of codes, thanks for the tips

0
Hassia Issahโ€ข 50,670

@Hassiai

Posted

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

The body has a wrong background-color, the background-color of the body should be the color of p.

To center .container using flexbox or grid, add min-height:100vh; display: flex; align-items: center: justify-content: center; or min-height:100vh; display: grid place-items: center to the body.

To center .container on the page using flexbox:
body{
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
To center .container on the page using grid:
body{
min-height: 100vh;
display: grid;
place-items: center;
}

Give the img a max-width of 100% and give h1 and p the same font-size of 15px and the same margin-left, margin-right and margin-top values. Give p a margin bottom value.

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

Aldrin Fernandezโ€ข 190

@aljager1983

Posted

@Hassiai thanks for the tip, very much appreaciate it,

0
Aldrin Fernandezโ€ข 190

@aljager1983

Posted

Thanks guys @Hassiai and @MelvinAguilar for the tips, very much appreciate it.

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