Design comparison
Community feedback
- @HassiaiPosted almost 2 years ago
There is no need for <div class="bg"> in the html and in its styling in the css.
Replace<div class="card">with the main tag and <div class="attribution"> with the footer tag to fix the accessibility issues. click here for more on web-accessibility and semantic html
Add the alt attribute
alt=" "
to the img tag to fix the error issues, the value of the alt tag is the description of the image.Give the body the background-color you gave to .bg. There is no need to give the root and html a min-height, background-color and min-width values they are not needed. change the margin value in r the root and html to 0
margin:0;
To center .card on the body using flexbox, add min-height: 100vh; display: flx; justify-content: center; align-items: center;
To center .card on the page using flexbox: body{ min-height: 100vh; display: flex; align-items: center; justify-content: center; }
For a responsive content which wont require a media query for this challenge , replace the width with max-width and give it a fixed value
max-width: 320px
. there is no need for the height value replace it padding value for all the sides, this will prevent the content from overflowing. `padding: 15px'. Give the img a max-width of 100%instead of a fixed max-width and max-height 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 helpful0@fa7ehPosted almost 2 years ago@Hassiai Thanks for your response.
I updated the code.
Can you please enlighten me more about responsive content? I do get confused with images and div, how I make them responsive based on the size of the display without media queries?
0@HassiaiPosted almost 2 years ago@fa7eh responsive content shrinks on smaller screens, prevent the content from overflowing and fit into the screen without changing anything in the content. Giving .card a max-width value means this value is the maximum width the content can have. e.g: max-width:400px` means the maximum width .card can have is 400px and can have any width below this value.
Hope am helpful.
Marked as helpful0 - @MohmedElshaarawyPosted almost 2 years ago
Hello fa7eh . Good job on completing the challenge !
I have some suggestions about your code that might interest you.
HTML :
Use the <main> tag to wrap all the main content of the page instead of the <div> tag. With this semantic element you can improve the accessibility of your page. Use the <footer> tag to wrap the footer of the page instead of the <div class="attribution">. The <footer> element contains information about the author of the page, the copyright, and other legal information. 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 :
Instead of using pixels in font-size, use relative units like em or rem. The font-size in absolute units like pixels does not scale with the user's browser settings. This can cause accessibility issues for users who have set their browser to use a larger font size. You can read more about this here . Use min-height: 100vh instead of height: 100vh. The height property will not work if the content of the page grows beyond the height of the viewport. I hope you find it useful!
Happy coding! ❤️
Marked as helpful0@fa7ehPosted almost 2 years ago@MohmedElshaarawy
I updated the code. Can you please check If there are still some improvements needed?
Appreciate your response.
0 - @IleolamiPosted almost 2 years ago
the paragraph is outside the div
0
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