Design comparison
Solution retrospective
Trying to solve QR component
Community feedback
- @HassiaiPosted over 1 year ago
Replace<div class="container">with the main tag, <h2> with <h1> and <div class="attribution"> with the footer tag to make the page 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.
There is no need to style .container, give its background-color to the body. To center .qr-holder on the page using flexbox or grid instead of margin,
- USING FLEXBOX: add min-height:100vh; display: flex; align-items: center: justify-content: center; to the body
body{ min-height: 100vh; display: flex; align-items: center; justify-content: center; }
- USING GRID: add min-height:100vh; display: grid place-items: center to the body
body{ min-height: 100vh; display: grid; place-items: center; }
For a responsive content which wont require a media query for this challenge,
- Give .qr-holder a fixed max-width value, a padding value for all the sides
max-width: 320px which is 20rem/em padding:16px which is 1rem/em
, a background-color of white and a border-radius, the rest are not needed. - Give the img a max-width of 100% and a border-radius value, the rest are not needed.
Give .text a margin value for all the sides, text-align: center and a font-size of 15px which is 0.9375rem, this will be the font-size of both p and h1. Give p a margin-top or h1 a margin-bottom value for the space between the text.
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
0 - @0xabdulkhaliqPosted over 1 year ago
Hello there π. Congratulations on successfully completing the challenge! π
- I have other recommendations regarding your code that I believe will be of great interest to you.
CSS π¨:
- Looks like the component has not been centered properly. So let me explain, How you can easily center the component without using
margin
orpadding
.
- We don't need to use
margin
andpadding
to center the component both horizontally & vertically. Because usingmargin
orpadding
will not dynamical centers our component at all states
- To properly center the component in the page, you should use
Flexbox
orGrid
layout. You can read more about centering in CSS here π.
- For this demonstration we use css
Grid
to center the component
body { min-height: 100vh; display: grid; place-items: center; }
- Now remove these styles, after removing you can able to see the changes
.qr-holder { margin-top: 25px; }
- Now your component has been properly centered
HTML π·οΈ:
- This solution lacks semantic markup, which causes lacking of landmark for a webpage and allows accessibility issues to screen readers, due to accessibility errors our website may not reach its intended audience, face legal consequences, and have poor search engine rankings, highlighting the importance of ensuring accessibility and avoiding errors.
- What is meant by landmark ?, They used to define major sections of your page instead of relying on generic elements like
<div>
or<span>
. They are use to provide a more precise detail of the structure of our webpage to the browser or screen readers
- For example:
- The
<main>
element should include all content directly related to the page's main idea, so there should only be one per page - The
<footer>
typically contains information about the author of the section, copyright data or links to related documents.
- The
- So fix it by replacing the
<div class="container">
element with the semantic element<main>
in yourindex.html
file to improve accessibility and organization of your page.
.
I hope you find this helpful π Above all, the solution you submitted is great !
Happy coding!
0 - @vinumanPosted over 1 year ago
Hello,
Good job completing the project. The design looks really good.
-
Kindly Use theΒ <main>Β tag to enclose the content instead of the 'container' div. The <main> tag is used to indicate the primary content of the document, and it helps search engines and accessibility tools to understand the structure and hierarchy of the content on the page.
-
100vh represents 100% of the viewport height, which means that the element will take up the entire height of the visible area of the browser window. This can result in an oversized height for the element, creating unnecessary white space and pushing other elements off the visible area of the page. Its better to avoid the same.
-
Hope this helps. Happy coding!
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