DEV Community

Ega Prasetya
Ega Prasetya

Posted on

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..