Creating a Responsive QR Code Component with HTML and CSS
Design comparison
Solution retrospective
What is the purpose of using the meta viewport tag in HTML when designing a responsive web component? How does this tag help ensure that the component is properly displayed on a variety of screen sizes and devices?
Community feedback
- @HassiaiPosted over 1 year ago
Replace <div class="container"> with the main tag and <h2> with <h1> to make page /content accessible. click here for more on web-accessibility and semantic html
Every html must have <h1> to make it accessible. Always begin the heading of the html with <h1> tag wrap the sub-heading of <h1> in <h2> tag, wrap the sub-heading of <h2> in <h3> this continues until <h6>, never skip a level of a heading.
Give the alt attribute in the img a value. The value of the alt attribute is the description of the image. For decorative images like icons, there is no need to give it an alt value, for more on alt attribute Click here.
Reduce the padding value of .card for it to be equivalent to the design.
padding:16px which is 1em/rem
To center .container on the page using flexbox only instead of flexbox and margin, add justify-content: center to the body and remove the margin value in .container.
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 helpful0 - @KingHoreyPosted over 1 year ago
The meta viewport instructs the browser on how to adjust it's dimensions and contents to fit the device's width.
This is because when the page loads, the browser would by default want to load the original size but this would be too big on some screens. That is where the meta tag comes in.
<meta name="viewport" content="width=device-width, initial-scale=1.0">
The attribute width, instructs the browser to set the width to the width of the device and 'initial-scale' sets the zoom to level 1
Marked as helpful0
Please log in to post a comment
Log in with GitHubJoin 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