← Back toCross browser

Normalize CSS

Written byPhuoc Nguyen
Created
07 Sep, 2022
Each browser provides a set of default styles which are applied for every web page it renders. The default style sheet is also known as the user-agent style sheet. For example, here is the default styles provided by popular browsers:
Since they aren't the same as each other, a web page looks differently on each browser. Normalizing CSS is a technique to fix the issue. It tries to make the default styles of native elements consistently cross browsers.
For example, we can use the HTML 5 `hidden` attribute to hide an element completely:
html
<input type="text" hidden />
However, the attribute isn't supported on IE 10. So we should include the following declaration:
css
[hidden] {
display: none;
}
normalize.css is a popular library providing these kinds of fixes. If you take a look at its source code, you'll realize that there are lot of bug fixes for different browsers such as IE, Chrome, Firefox, Safari there.
Popular CSS libraries include or build their normalized CSS on top of `normalize.css`, for example:
If you found this post helpful, please consider giving the repository a star on GitHub or sharing the post on your favorite social networks 😍. Your support would mean a lot to me!

Questions? 🙋

Do you have any questions about front-end development? If so, feel free to create a new issue on GitHub using the button below. I'm happy to help with any topic you'd like to learn more about, even beyond what's covered in this post.
While I have a long list of upcoming topics, I'm always eager to prioritize your questions and ideas for future content. Let's learn and grow together! Sharing knowledge is the best way to elevate ourselves 🥷.
Ask me questions

Recent posts ⚡

Newsletter 🔔

If you're into front-end technologies and you want to see more of the content I'm creating, then you might want to consider subscribing to my newsletter.
By subscribing, you'll be the first to know about new articles, products, and exclusive promotions.
Don't worry, I won't spam you. And if you ever change your mind, you can unsubscribe at any time.
Phước Nguyễn