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

Responsive QR card using HTML and CSS

@diksha-singh-17

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

P

@Islandstone89

Posted

HTML:

  • Every webpage needs a <main> that wraps all of the content, except for <header> and footer>. This is vital for accessibility, as it helps screen readers identify a page's "main" section. Wrap .container in a <main>.

  • The image has meaning, so it must have proper alt text. Write something short and descriptive, without including words like "image" or "photo". Screen readers start announcing images with "image", so an alt text of "image of qr code" would be read like this: "image, image of qr code". The alt text must also say where it leads(frontendmentor.io).

  • Headings should always be in order, so you never start with a <h3>. Change it into a <h1>.

  • .attribution should be a <footer>, and you should use <p> for the text inside.

CSS:

  • It is best practice to write CSS in a separate file, often called style.css. Create one in the same folder as the index.html, and link to it in the <head>: <link rel="stylesheet" href="style.css">.

  • Including a CSS Reset at the top is good practice.

  • Use the style guide to find the correct font-family.

  • Add around 1rem of padding on the body, so the card doesn't touch the edges on small screens.

  • Remove the margin on the card.

  • Add min-height: 100svh and gap: 2rem on the body.

  • Remove all widths and heights.

  • Add a max-width of around 20rem on the card, to prevent it from getting too wide on larger screens.

  • font-size must never be in px. This is a big accessibility issue, as it prevents the font size from scaling with the user's default setting in the browser. Use rem instead.

  • Since all of the text should be centered, you only need to set text-align: center on the body, and remove it elsewhere. The children will inherit the value.

  • On the image, add display: block and max-width: 100% - the max-width prevents it from overflowing its container.

  • As the design doesn't change, there is no need for any media queries. When you do need them, they should be in rem, not px. Also, it is common practice to do mobile styles first and use media queries for larger screens.

Marked as helpful

2

@diksha-singh-17

Posted

Hey,@Islandstone89 I appreciate your code review! Your insights and suggestions are valuable to me. I'll go through each point you mentioned and make the necessary improvements.

1
DInosMpo 210

@DinosMpo

Posted

Hello, nice try for starter, some advice that i could give are that you could use the display: flex; justify-content: center; align-items: center; height: 100vh; in your .container class to be able to center your element to the center of the screen. Another one is for the text__area container that you use, try to use a class to the paragraph something like class='description' and give it the text-align: center; to be able to center your text. Also try to write your css to a separate file just to have a cleaner html code and more maintainable css code. I hope that i gave you some help and good advice

Marked as helpful

2

@diksha-singh-17

Posted

Hey, thanks a lot for taking the time to review my code! I found your feedback helpful, and I'll make the suggested changes.

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