DEV Community

Cover image for 5 Common CSS mistakes developers make

5 Common CSS mistakes developers make

Animesh Dhanuk
PHP Developer with 8+ years of experience.
・1 min read

If you are starting your carrier as a web developer, CSS is a headache for many developers, based on my experience. It takes time to learn it and master it. This article is covering some common mistakes that you may face when writing CSS code.

1. Using px when it’s not needed⁣

Do you know that you don’t need to use px when you want to set the a value to 0:

2. Repeating the same code⁣

Always keep in mind the DRY rule. Don’t repeat yourself. The number of code lines will cost you in terms of app performance and loading time.

3. Using color names⁣

Using a color code is better then a name

4. Not using shorthand properties⁣

Avoid multiline of code when you can do the same thing with one line

5. No font fallback⁣

Always complete the font you’re using

7 Most Common Git Mistakes

Discussion (2)

sloan profile image

Hi there, we encourage authors to share their entire posts here on DEV, rather than mostly pointing to an external link. Doing so helps ensure that readers don’t have to jump around to too many different pages, and it helps focus the conversation right here in the comments section.

If you choose to do so, you also have the option to add a canonical URL directly to your post.

Some comments have been hidden by the post's author - find out more