Design comparison
Solution retrospective
- Is there anything i used that i shouldn't use inside my CSS?
Community feedback
- @taco-nekoPosted over 1 year ago
I noticed you're using absolute positioning to center items while also having a display of flex and using
justify-content
. It's a bit redundant, and you should just use one or the other (I'd recommend flex). Or remove all of that and just usemargin: auto
.This part of your code caught my attention:
.attribution { font-size: 11px; text-align: center; position: absolute; bottom: 0; font-size: 1em; left: 50%; transform: translateX(-50%); margin-bottom: 15px; }
You set a
font-size
of 11px and then overwrote it with 1em. I'm not sure if this was intentional. Also again, you could center this withmargin: 0 auto 15px
ormargin: 15px auto
instead of absolute positions.Marked as helpful1@TwixGamer00Posted over 1 year ago@taco-neko Hi,
The double font-size wasn't intented, I've removed it.
Can you explain me which parts I should remove and which I should keep or change, to prevent using both justify-content and flex?
0@taco-nekoPosted over 1 year ago@TwixGamer00 Remove everything related to the centering that you have used. In this case that means remove the
position: absolute
, all thetop
left
bottom
right
properties, and thetransform
. Then also removedisplay: flex
,flex-direction
,justify-content
, andalign-items
. Replace all of this with a simplemargin: auto
.Simplicity is best when it comes to things like this in CSS. Also, absolute positioning can have unintended effects such as things going out of bounds.
I've also noticed you use pixel values a lot. I suggest using rems instead. See this video.
Also, never set a
font-size
in ems unless you know what you are doing. Use rems. See this video for an explanation.Marked as helpful1@TwixGamer00Posted over 1 year ago@taco-neko
I changed all units to Rem! Also removed the
position: absolute
andtop
left
bottom
, etc. Although i did keep the position absolute on the footer.Thanks for your feedback!
1 - @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
non-semantic
markup, which causes lacking of landmark for a webpage
- So fix it by replacing the
<div class="container">
element with the semantic element<main>
along with<div class="attribution">
into a<footer>
element 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 are use to provide a more precise detail of the structure of our webpage to the browser or screen readers
- 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 - The
<footer>
typically contains information about the author of the section, copyright data or links to related documents.
- The
.
I hope you find this helpful 😄 Above all, the solution you submitted is great !
Happy coding!
Marked as helpful1
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