Sometimes we try to write a CSS stylesheet with fewer possible lines.
Take a look at this example:
Note: Formerly borders , where all width:1px , border-style:solid and border-color:#000
Scenario: We want to change:
width : R, L and B to 0pxborder-color of: T to #ddd
Used code:
border:0 solid #ddd; border-top-width:1px;
What did the extra code above do:
- change
border-color : R, L and B (3 actions) - change
width of: T (1 action)
Here is the code with 0 unnecessary actions:
border-right-width:0; border-bottom-width:0; border-left-width:0; border-top-color:#ddd;
Question: Should we sacrifice performance for lower code / readability?
source share