3 Column Preview Card Component, HTML, CSS, flexbox, mobile first
Design comparison
Solution retrospective
Hello Everyone!
I just posted the solution for this challenge, I had a lot of fun doing it and resolving some margin and padding "puzzles".
My goal was to make this challenge pixel perfect even with the paragraphs break lines. However, I am not sure if this approach has made my css larger than what it's needed.
Please, if you have any feedbacks about this or any other suggestions, feel free to let me know.
Community feedback
- @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.
HEADINGS β οΈ:
- 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 for better layout.
- 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: 80px auto; }
.
I hope you find this helpful π Above all, the solution you submitted is great !
Happy coding!
Marked as helpful0@andres-avPosted over 1 year ago@0xAbdulKhalid
Wow! you went above and beyond on this feedback, I really appreciate all the information you shared with me because those were topics I did not know of.
Thanks to this I have homework now and I know it will improve my coding skills in the future.
Once again, Thank you so much!!
0 - @SoniBasantPosted over 1 year ago
Your hard work shows in this project. Very good job.
As for the suggestion -
- Use h1 for
<h2>SEDANS</h2>
. One heading is necessary in semantic coding. That's why the warning Page should contain a level-one heading. You can handle font-size in CSS. - Use flex in body so your solution will be at center.
body { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
Other than that no suggestion. Good work. : )
Marked as helpful0 - Use h1 for
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