@MelvinAguilar
Posted
Hello there π. Good job on completing the challenge !
I have some suggestions about your code that might interest you.
Styles:
- Remove the max-width and height of the * selector, let it occupy 100% of the screen width. When you set a fixed width, it will only work well when the viewport has the same width,
- There are some lines of text that are unnecessary, delete or comment them out: line github
-
Centering an element with
position: absolute
would make your element behave strangely on some screen sizes, "there's a chance the content will grow to overflow the parent". You can use Flexbox or Grid to center your element. You can read more about centering in CSS here π.Before trying to make your solution look like the picture, you should try to fix your solution by removing all absolute positions.
.design { background-color: hsl(212, 45%, 89%); min-height: 100vh; display: grid; place-content: center; /* width: 1200px; */ /* height: 700px; */ /* position: relative; */ /* left: 120px; */ /* right: 120px; */ /* top: 64px; */ /* bottom: 64px; */ } .container { /* position: absolute; */ /* width: 300px; */ max-width: 300px; /* height: 420px; */ background-color: hsl(0, 0%, 100%); /* left: 450px; */ /* right: 450px; */ /* top: 140px; */ /* bottom: 140px; */ border-radius: 25px; /* padding-top: 15px; */ /* padding-bottom: 15px; */ /* padding-left: 15px; */ /* padding-right: 15px; */ padding: 15px; /* The padding property is a shorthand property for all the paddings*/ } .container img { /* position: absolute; */ /* width: 250px; */ /* height: 250px; */ /* left: 40px; */ /* right: 40px; */ width: 100%; border-radius: 15px; } .container h2 { /* position: absolute; */ color: hsl(218, 44%, 22%); /* top: 250px; */ font-size: 17px; margin: 15px; } .container p { /* position: absolute; */ color: hsl(220, 15%, 55%); font-size: 15px; /* top: 350px; */ margin: 15px; }
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.
Alt text π·:
- The
alt
attribute should not contain underscores or hyphens, it must be human readable and understandable.
- 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. 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 π.
-
You should use a CSS reset to remove the default browser styles and make your page look the same in all browsers.
Popular CSS resets:
I hope you find it useful! π
Happy coding!
Marked as helpful
@floppitommiiiii
Posted
Thank you so much, I really appreciate your comment.