Design comparison
Solution retrospective
I have one question:
I learned that I can give a fixed font-size to the document html using Font-size: 62.5% to have 10px and use rems. However some people says that is not correct because the percentage is not the same for all browsers.
My doubt is: What is better to use, px or %?
Community feedback
- @vanzasetiaPosted almost 3 years ago
š Hi Rebeitte!
š Congratulations on finishing this challenge! Regarding your question, for
font-size
, it is recommended to userem
or sometimesem
unit instead ofpx
or%
. Also, you don't need to think about how much1rem
is inpx
. You might find it helpful if you don't think in terms ofpx
at all.Also, changing the root
font-size
can have a lot of negative impacts with almost no benefit. Read what an accessibility expert (Grace Snow) has said about it.For the feedback:
- Accessibility
- Don't uppercase the text manually, the screen reader will spell it letter by letter. Use CSS instead.
- Create a custom
:focus-visible
styling to any interactive elements (button
, links,input
,textarea
). This will make the users can navigate this website using keyboard (Tab
) easily. - For any decorative images, each
img
tag should have emptyalt=""
andaria-hidden="true"
attributes to make all web assistive technologies such as screen reader ignore those images. In this case, all images are decorative only. - The
Learn more
button should be a link, since they will navigate the user to the different web page, if this is a real website.
- Best Practice (Recommended)
- You can import two font families at once.
- Styling
- Setting the
box-sizing: border-box;
on thehtml
element doesn't make all the elementsbox-sizing: border-box;
. You can make all the elements inherit thebox-sizing
value from thehtml
by doing the following.
- Setting the
html { box-sizing: border-box; } *, *::after, *::before { box-sizing: inherit; }
- To make the cards perfectly in the middle of the page, you can make the
body
element as a flex container.
/** * 1. Make the direct child element (main) * vertically center and allow the body * element to grow if needed */ body { display: flex; align-items: center; justify-content: center; min-height: 100vh; /* 1 */ }
That's it! Hopefully, this is helpful!
Marked as helpful1@RebeittePosted almost 3 years ago@vanzasetia Thank you a lot! I loved your feedback, I will put in practice all what you told me in my next projects
0 - Accessibility
- @DanK1368Posted almost 3 years ago
Hey..i usually apply a font size of 62.5% for the whole project. It's just a bit easier to calculate as 1rem will equal to 10px. Without setting this percentage it will be 1rem=16px.
You generally want to avoid using px for setting widths and heights, as it will not be responsive to the size of the screen. Unless you really want it to be fixed then you can use px. It depends on what you want to achieve. :)
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