Design comparison
Solution retrospective
When is relative and absolute positioning useful in project? I only used margins for positioning but should I have used something else? The desktop preview design has a background that is different from the main desktop design. Any ideas on how to replicate that? Or what was the purpose of the preview design? How do I link my solution url? I have linked the live site url but how do I link the html and css in one link?
Community feedback
- @HassiaiPosted over 1 year ago
Replace<div class="middle">with the main tag, <p> with <h1>, <h6> with <p>and <div class="attribution"> with the footer tag to fix the accessibility issues. 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.
Give h1 and p the same font-size of 15px which is 0.9375rem, text-align: center, the same margin-left, margin-right and margin-top values. Give p a margin bottom value.
To center .middle on the page using flexbox or grid instead of 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.
USING FLEXBOX: body{ min-height: 100vh; display: flex; align-items: center; justify-content: center; }
USING GRID: body{ min-height: 100vh; display: grid; place-items: center; }
For a responsive content, replace the height in .middle with a padding value for all the sides , the width with max-width and increase its value and give the img a max-width of 100% and a border-radius value.
.middle{ background-color: hsl(0, 0, 100%); max-width:320px; padding:16px; border-radius: 10px; } img{ max-width:100%; border-radius: ; }
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@CNash23Posted over 1 year ago@Hassiai Thank you for the feedback! I will work on it as soon as possible.
0 - @visualdennissPosted over 1 year ago
Your submission looks great! Congrats on completing the challenge.
In this challenge, absolute positioning is not necessary. Usually try to use them only when they are absolutely needed, as they take items out of normal document flow.
Also for centering, when you can, use flexbox or grid instead of margins. (Sometimes using margin: 0 auto; for horizontal centering is perfectly valid option too). Because when there are more elements on the page, it might cause some layout issues.So remove margin: 200px auto; from .middle instead here is e.g. with Grid centering:
body { background-color: hsl(212, 45%, 89%); min-height: 100vh; display: grid; place-items: center; }
or
body { background-color: hsl(212, 45%, 89%); min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; }
100vh is 100% of the viewport height, meaning full screen. So we expand our area to full screen to center accordingly.
Hope you find this feedback helpful!
Marked as helpful1@CNash23Posted over 1 year ago@visualdenniss Thank you for feedback on my project. I will work on the changes as soon as I can.
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