Design comparison
Solution retrospective
In the mobile layout , the design demanded some space above and below the container. I did it with some margin-top and margin-bottom.
My question here, is it possible to create the space without using margin property. is it possible using flexbox? I tried it, but no luck!
Also suggest me with some best practices i can implement in my code? Thanks in advance..
Community feedback
- @0xabdulkhaliqPosted over 1 year ago
Vanakkam Thozha π. 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 consists incorrect usage of
<h1>
so it can cause severe accessibility errors due to incorrect usage of level-one headings<h1>
- Every site must want only 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.
- In this solution there's three
<h1>
elements, like this<h1>SEDANS</h1>
, you can preferably use<h2>
instead of<h1>
. Remember<h1>
provides an important navigation point for users of assistive technologies so we want to use it wisely
- 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)
- Example:
<h1 class="sr-only">3-column preview card component</h1>
- If you have any questions or need further clarification, you can always check out
my submission
for this challenge where i used this technique and feel free to reach out to me.
.
I hope you find this helpful π Above all, the solution you submitted is great !
Happy coding!
Marked as helpful0 - @fernandolapazPosted over 1 year ago
Hi ππ», some of this may interest you:
HTML / ACCESSIBILITY:
- The main content of every page (the card in this case) should be wrapped with the
<main>
tag.
- The icons are decorative images and therefore need an empty
alt
attribute to be ignored by a screen reader.
- Remember that
<button>
should be used for any interaction that performs an action on the current page and<a>
should be used for any interaction that navigates to another view. It seems that links are more appropriate in this case.
CSS:
- Think about using relative units like rem or em since they are better for scalable layouts. Something simple to start with would be to convert to rem (1 rem equals 16px by default). Consider this suggestion especially for the
font-size
.
- It might be good to get used to designing with the Mobile first approach, which means designing for mobile first and then for desktop or any other device, as it is widely considered best practice.
- Regarding your comment: if the height of the viewport is greater than the the content, a space will be generated automatically if you have it centered using grid or flex (as you did); but if you want a space when the height of the viewport is less than the content then you will have to use margin in the '.wrapper' or padding in the body.
I hope itβs useful : )
Regards,
Marked as helpful0@siva-krish45Posted over 1 year ago@fernandolapaz thanks for your valuable comments, I learned a lot.
1 - The main content of every page (the card in this case) should be wrapped with the
- @waad2lfPosted over 1 year ago
Well done, Your project looks nice. about your question, you can use
justify-content:space-between
on the container.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