Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What order should you put CSS properties in? [duplicate]

Tags:

css

standards

Is there a correct order to put your CSS properties in? I've never been told to put my properties in a certain order. I guess it's personal preference?

Server side languages have various standards you can code to. Are there standards for CSS?

I tend to do:

.element
{
    /* display: */
    /* position:, top:, right:, bottom:, left: */
    /* width:, height: */
    /* margin:, padding: */
    /* color:, font: */
    /* background: */
    /* border:, border:radius: */
    /* z-index: */
}
like image 349
Pattle Avatar asked Sep 03 '25 04:09

Pattle


1 Answers

Though there is no standard around it. And probably that's how a declarative DSL should be.

The following links might give you an idea on how you can form a standard for your domain

  • Conventional Order of CSS properties
  • CSS Lisible
  • CSS Comb
  • Order Your CSS Properties
like image 143
Vivek Avatar answered Sep 04 '25 23:09

Vivek