Design comparison
Community feedback
- @HassiaiPosted almost 2 years ago
Replace the div with the main tag to fix the accessibility issues. click here for more on web-accessibility and semantic html There is no need for the <br> in the html.
To center the div 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 the div on the page using flexbox: body{ min-height: 100vh; display: flex; align-items: center; justify-content: center; }
To center the div on the page using grid: body{ min-height: 100vh; display: grid; place-items: center; }
For a responsive content, there is no need to give the div a height value, replce the width of the div with
max-width
, give it a fixed padding value and increase the max-width.max-width: 320px padding:16px
.Give the img a max-width of 100% for a responsive width instead of an inline-styling with a width and height value.
Give h1 and p the same font-size of 15px, and the same margin-left, margin-right and margin-top 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
0 - @MelvinAguilarPosted almost 2 years 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.
- Change the name of the file
qr.html
toindex.html
to access the solution only using https://ayupaul.github.io/qr-code/. by default when typing a url the fileindex.html
is displayed and that's why you had to manually write the file name. This name for the main document is a standard.
HTML π·οΈ:
- Wrap the page's whole main content in the
<main>
tag.
- The <br> tag is often used to create line breaks, but it doesn't convey any semantic meaning. When a screen-reader reads the text, it will break the flow of reading at the line break tag, which can be confusing for users. More information here.
Alt text π·:
- The
alt
attribute should not contain the words "image", "photo", or "picture", because the image tag already conveys that information.
-
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 π¨:
- 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 π.
- For better readability, consider changing the color of the paragraph element to a darker hue, such as
hsl(220deg, 15%, 55%)
. This will increase contrast and make the text more legible against the background.
CSS Reset π:
-
You should use a CSS reset. A CSS reset is a set of CSS rules that are applied to a webpage in order to remove the default styling of different browsers.
CSS resets that are widely used:
I hope you find it useful! π Above all, the solution you submitted is great!
Happy coding!
0 - Change the name of the file
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