lundi 6 février 2017

Is CSS indentation just for readability?

I was reading this from the SCSS docs:

Nested Rules

Sass allows CSS rules to be nested within one another. The inner rule then only applies within the outer rule’s selector. For example:

 #main p {   color: #00ff00;   width: 97%;

   .redbox {
     background-color: #ff0000;
     color: #000000;   } } 

is compiled to:

 #main p {   
      color: #00ff00;   width: 97%; }   
      #main p .redbox {
         background-color: #ff0000;
         color: #000000; }

Is the bottom code block just standard CSS? Is the indentation necessary? Or is it just convention to write it this way in CSS files?

Aucun commentaire:

Enregistrer un commentaire