Design comparison
Solution retrospective
Hello, I'm Mishael Joe by name. This was a fantastic project to work on (it was actually easy tho). But, I'm not so sure if I got the media query right, please can someone check it for me? Project link
Community feedback
- @Umer-KhokharPosted over 1 year ago
Hi thereπ,
Always use flexbox to center items (in your case card)
.card {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
One thing more that in media quries don;t set width of img tag set the width to the whole container,
As you set the max-width to image your design looks bad in mobile devices
@media(max-width: 370px) {
.card { width: 200px; }
In the card case,Never use media quries as set width of card mobile first so
You should not need any quries I hope this will help you π
Marked as helpful0 - @0xabdulkhaliqPosted over 1 year ago
Hello there π. Congratulations on successfully completing the challenge! π
- I have other recommendations regarding your code that I believe will be of great interest to you.
HTML π·οΈ:
- This solution generates accessibility error reports, "All page content should be contained by landmarks" is due to incorrect usage of
semantic
markup, which causes lacking of landmark for a webpage
- So fix it by replacing the
<section class="card">
element with the semantic element<main>
in yourindex.html
file to improve accessibility and organization of your page.
- What is meant by landmark ?, They used to define major sections of your page instead of relying on generic elements like
<div>
or<span>
- They convey the structure of your page. For example, the
<main>
element should include all content directly related to the page's main idea, so there should only be one per page
HEADINGS β οΈ:
- And, this solution has also generated accessibility error report due to lack of level-one heading
<h1>
- Every site must want at least one
h1
element identifying and describing the main content of the page.
- An
h1
heading provides an important navigation point for users of assistive technologies, allowing them to easily find the main content of the page.
- So we want to add a level-one heading to improve accessibility by reading aloud the heading by screen readers, you can achieve this by adding a
sr-only
class to hide it from visual users (it will be useful for visually impaired users)
CSS π¨:
- let me explain, How you can easily center the component.
- We don't need to use
margin
andpadding
to center the component both horizontally & vertically. Because usingmargin
orpadding
will not dynamical centers our component at all states
- To properly center the component in the page, you should use
Flexbox
orGrid
layout. You can read more about centering in CSS here π.
- For this demonstration we use css
Grid
to center the component
body { min-height: 100vh; display: grid; place-items: center; }
- Now remove these styles, after removing you can able to see the changes
.card { margin: 3rem auto; }
.
I hope you find this helpful π Above all, the solution you submitted is great !
Happy coding!
0 - @DrMESAZIMPosted over 1 year ago
hi Joe this was great work from you since I also noticed this was your first project. I would like you to work on the background color so as to match better with the design expectations.
If you find my suggestions difficult to implement . You can join us for our weekly live streams where we assists other developers by providing helpful reviews and feedback with live Frontend mentor code edits and reviews on this link. Your solution will also be reviewed and edited by myself link here >> https://youtube.com/live/L6WTd7HRTMM?feature=share
0@Mishael-JoePosted over 1 year ago@DrMESAZIM Thank you so much Sir. How do I join the live stream?
0@DrMESAZIMPosted over 1 year agolink here >> https://youtube.com/live/L6WTd7HRTMM?feature=share@Mishael-Joe
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