Design comparison
Community feedback
- @HassiaiPosted over 1 year ago
Replace <div id="mainDiv"> with the main tag, <p id="p1"> with <h1> to fix the accessibility issues. click here for more on web-accessibility and semantic html
To center #mainDiv on the page using flexbox or grid instead of a margin, 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 #mainDiv on the page using flexbox: body{ min-height: 100vh; display: flex; align-items: center; justify-content: center; }
To center #mainDiv on the page using grid: body{ min-height: 100vh; display: grid; place-items: center; }
For a responsive content replace the width in #mainDiv with max-width, increase the width for it to be equivalent to the width of the design.
max-width:320px
.Replace the height in #mainDiv with a padding value fo r all the sides, this will prevent the content from overflowing on smaller screens and its a responsive replacement.
padding: 16px
Give the section 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.
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 - @MelvinAguilarPosted over 1 year ago
Hello π. Congratulation on successfully completing your first challenge π ! !
I have some recommendations regarding your code that I believe will be of great interest to you.
HTML π·οΈ:
- Wrap the page's whole main content in the
<main>
tag.
- The text
Improve Your Front-End Skills by Building Projects
is considered a heading element (h1).
- You should not use inline-CSS because it is not a good practice. Instead, you should use an external stylesheet to style your page. By doing this, you will be able to have a better organization of your code and will be able to understand it better.
- For specificity reasons you should work with classes instead of ids because they are more reusable. You can use ids to work with JavaScript, but you should use classes to style your elements. You can read more about this here π. Alt text π·:
-
The
alt
attribute should explain the purpose of the image. Uppon scanning the QR code, the user will be redirected to the frontendmentor.io website, so a betteralt
attribute would beQR code to frontendmentor.io
If you want to learn more about the
alt
attribute, you can read this article. π.
CSS π¨:
- Use more descriptive class names to improve readability of front-end code. You can learn BEM naming convention to improve your class names.
- Instead of using pixels in font-size, use relative units like
em
orrem
. The font-size in absolute units like pixels does not scale with the user's browser settings. Resource π.
- To center the component in the page, you should use Flexbox or Grid layout. You can read more about centering in CSS here π.
I hope you find it useful! π Above all, the solution you submitted is great!
Happy coding!
Marked as helpful0 - Wrap the page's whole main content in the
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