Does the structure of CSS has any impact on the performance of the site?
Scenario 1)
.class1 {position:absolute; top:0; right:13%}
.class2 {position:absolute; top:0; right:17%}
.class3 {position:absolute; top:0; right:29%}
Scenario 2)
.class1, .class2, .class3 {position:absolute; top:0}
.class1 {right:13%}
.class2 {right:17%}
.class3 {right:29%}
My guess would be that 1) is better in terms of performance ?
I know that 1) is easier to maintain but what about performance?
Also, what is the best way to write CSS / some tricks to improve site performance by optimizing CSS?
>Solution :
I think it’s just less code = better performance
but not by much unless you are working on thousands of lines of code
I would just keep my code as easy to read as possible and delete anything unnecessary.