Design comparison
Solution retrospective
- I find aligning elements a bit difficult.
- Vertical alignment and the exact position or dimension based on drawings.
- To become better and faster.
Community feedback
- @HassiaiPosted almost 2 years ago
Replace<div class="card-container">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
There is no need to give the body a width and height value
To center .card-container on the page using flexbox or grid, 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 .card-container on the page using flexbox: body{ min-height: 100vh; display: flex; align-items: center; justify-content: center; }
To center .card-container on the page using grid: body{ min-height: 100vh; display: grid; place-items: center; }
Giv .desc 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 helpful1@RachelikPosted almost 2 years ago@Hassiai Thanks! I have made the changes. From the screenshot comparison, the font-size for h1 is about 22px (1.375em). Grid was working as fine as flexbox.
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.
HTML π·οΈ:
- Use semantic elements such as
<main>
and<footer>
to improve accessibility and organization of your page.
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 π.
- The
width: 100%
property in thebody
tag is not necessary. Thebody
tag is a block element and it will take the full width of the page by default.
- To center the component in the page, you should use Flexbox or Grid layout. You can read more about centering in CSS here π.
body { background-color: hsl(212, 45%, 89%); font-family: 'Outfit', sans-serif; font-size: 15px; /* NOTE: Convert to rem o em */ /* height: 100%; */ /* width: 100%; */ /* NOTE: Using flexbox to center the component */ min-height: 100vh; display: flex; flex-direction: column; justify-content: center; align-items: center; } .card-container { /* margin: 150px auto 0px auto; */ . . . }
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!
Marked as helpful1@RachelikPosted almost 2 years ago@MelvinAguilar Thanks. I have make the changes. These are really good improvements.
0 - Use semantic elements such as
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