And on CSS
- NEVER write font size in px! Or line height or letter spacing.
- normalize is a really old css reset and a lot isn't needed any more. I recommend you look up more modern resets like those by Andy Bell or Josh Comeau
- make sure any max widths for components or content is in rem not px so it is more responsive for all users, including those who change their font size settings
- buttons/ctas usually have padding. Worth checking. You don't want to create the whole height of a button with line height. Remember content editors could write more text in there or users change font size so they can end up wrapping over 2 lines. If relying on line height instead of padding for button height that could have undesirable results.
- if an icon and text is in a button consider using inline-flex and gap instead of margin-right on the icon. Just a more modern approach and common to prepare for different languages/text directions.
- similarly, using flex and gap would be shorter so more performant for the social links
- you should never ever need a media query at 375px wide
- media queries must always be defined in rem or em for a fully responsive result
- I am away from my computer so cannot check, but the sheer number of media queries in this stylesheet and the amount of pixels being used gives a code smell. That implies to me that this may have problems on some devices tbh. But like I said, I can't check it to be sure
Marked as helpful
@Muhammadjewel
Posted
@grace-snow , your comments are being much helpful 😃
- I'll change my px based text units in my next projects 👍 Your article was great and to the point.
- I've gone through Josh and Andy's articles about their resets. I'll start using the combined one.
- considering different languages/text directions will be a good approach, too 👍
- regarding the px use I've gone through some articles. It turns out I was behind the standards 😅 These articles were very useful to get the gist of the approach. The Surprising Truth About Pixels and Accessibility by Josh Comeau and PX, EM or REM Media Queries? by Zell Liew
- the reason for using 375px and several other breakpoints was to better adapt the page. I try to consider the screen sizes between breakpoints given in the design.