DEV Community

Ega Prasetya
Ega Prasetya

Posted on

8 4

Tips And Tricks Write Less CSS

Background

Alt Text

Font

Alt Text

Border

Alt Text

Outline

Alt Text

Margin

Alt Text

Padding

Alt Text

So how many do you use?

Top comments (5)

Collapse
 
perpetual_education profile image
perpetual . education

In almost all cases besides borders and margins, we prefer longhand. The short hand overrides everything - and it can really cause havoc when you're using the cascade.

Collapse
 
egaprsty profile image
Ega Prasetya

nice one

Collapse
 
perpetual_education profile image
perpetual . education

For example

.thing {
  background-position: whatevers;
}

@media (min-width: 600px) {
  background: red; /* removes the position */
}

and in general... "Writing too much CSS" isn't a problem. Your coworkers not being able to read your CSS is the problem.

Collapse
 
shvam0000 profile image
Shivam Shekhar

Thanks! This was really helpful and time-saving.

Collapse
 
egaprsty profile image
Ega Prasetya

you are welcome bro..

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

AWS GenAI LIVE!

GenAI LIVE! is a dynamic live-streamed show exploring how AWS and our partners are helping organizations unlock real value with generative AI.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️