Design comparison
Solution retrospective
All feedback is welcome.
Community feedback
- @sudhanshu287Posted over 1 year ago
Problems in Your Solution
- semantic HTML not included.
- Image is not set correctly.
- Layout not looks good.
Solution to your Problem
- always add <main></main> tag or a div with role="main" and one h1 tag is mandatory for accessibility.
- To make an image responsive always add two properties 'max-width:100%;', and 'height: auto;'
- To properly design your layout change these in your CSS classes
.container{ background-color: var(--white); max-width: 20%; margin: auto; padding: 22px; border-radius: 20px; display: flex; flex-direction: column; gap: 20px; } .image > img { max-width: 100%; height: auto; border-radius: 10px; } .bold { font-weight: 700; font-size: 22px; line-height: 1.4; text-align: center; color: var(--dark-blue); } .light { font-weight: 400; text-align: center; color: var(--grayish-blue); padding-bottom: 10px; } .attribution { position: absolute; bottom: 40px; left: 50%; transform: translateX(-50%); font-size: 11px; text-align: center; margin-top: 20px; } @media (min-width: 1025px) { .container { max-width: 21%; padding: 18px; margin-top: 100px; } }
- All these changes make your solution looks good.
Marked as helpful0 - @HassiaiPosted over 1 year ago
Replace<div class="container">with the main tag,<p class="bold"> with <h1> and <div class="attribution"> with the footer tag to make the page accessible. 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 the alt attribute in the img a value. The value of the alt attribute is the description of the image. For decorative images like icons, there is no need to give it an alt value, for more on alt attribute Click here.
To center .container on the page using flexbox or grid instead of giving .container a margin value, add min-height:100vh; display: flex; align-items: center: justify-content: center; to the body OR add 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; }
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.
For a responsive content which wot require a media query for this challenge,
- Give .container a fixed max-width value and reduce the padding value for all the sides
max-width: 320px which is 20rem/em padding:16px which is 1rem/em
- Give the img a max-width of 100% and a border-radius value, the rest are not needed.
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 and here
Hope am helpful.
Well done for completing this challenge. HAPPY CODING
0@RatifiedPosted over 1 year ago@Hassiai thank you for your comment. I hadn't thought about using flexbox to centre the content. It's certainly better than setting a margin.
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