Faster way to use CSS [closed]

0

Which is the fastest to use:

.testando1{display: none;}
.testando2{display: none;}
.testando3{display: none;}
.testando4{display: none;}
.testando5{display: none;}

Or:

.testando1, .testando2, .testando3, .testando4, .testando5 {display: none;}
    
asked by anonymous 23.11.2017 / 17:35

1 answer

1

A CSS file with only these instructions below weighs 75 bytes :

.testando1, .testando2, .testando3, .testando4, .testando5 {display: none;}

Another file with these weights 138 bytes :

.testando1{display: none;}
.testando2{display: none;}
.testando3{display: none;}
.testando4{display: none;}
.testando5{display: none;}
  

The size of the files may vary depending on the file system used by the OS or the indentation used.

Although they are extremely lightweight files you can know that the first option is better in term performance because it will load faster.

But as the Rafael Augusto spoke, in this situation it would be better to create a new class and add it in the elements.

    
23.11.2017 / 18:26