Partial Overrides
A partial override occurs when two or more rulesets containing related, but not identical declarations target the same element. This happens when a shorthand property overrides a longhand property, or visa versa. Here is a partial override in its simplest form:
1
<dl className="address">
2
margin: 20px 10px;
3
</dl>,
4
5
<footer>
6
<dl className="address">
7
margin-left: 20px;
8
</dl>
9
</footer>
Copied!
In the example above the first ruleset uses the shorthand property margin, which translated to computed styles equates to:
    margin-top: 20px;
    margin-right: 10px;
    margin-bottom: 20px;
    margin-left: 10px;
The second ruleset attempts to override the left margin using the longhand property margin-left. However since the left margin already has a value (of 10px) it cannot be overridden. Immutable styles detects this partial override and throws the following compile time error:
Another example of partial overrides can be seen when both shorthand and longhand border properties target the same element:
1
<img className="gravatar">
2
border: 1px solid gainsboro;
3
</img>,
4
5
<div className="feed">
6
<img className="gravatar">
7
border-left-color: tomato;
8
</img>
9
</div>
Copied!
The first ruleset uses the shorthand property border, which translated to computed styles equates to:
    border-top-width: 1px;
    border-top-style: solid;
    border-top-color: gainsboro;
    border-right-width: 1px;
    border-right-style: solid;
    border-right-color: gainsboro;
    border-bottom-width: 1px;
    border-bottom-style: solid;
    border-bottom-color: gainsboro;
    border-left-width: 1px;
    border-left-style: solid;
    border-left-color: gainsboro;
The second ruleset attempts to override the left border color using the longhand property border-left-color, which again is caught by the compiler:
Not all partial overrides are so easy to detect:
1
<h1>
2
font: 600 30px/1.5em sans-serif;
3
</h1>,
4
5
<nav>
6
<h1>
7
line-height: 1em;
8
</h1>
9
</nav>
Copied!
The first ruleset uses the shorthand property font, which translated to computed styles equates to:
    font-weight: 600;
    font-size: 30px;
    line-height: 1.5em;
    font-family: sans-serif;
Fortunately immutable styles is aware that the line-height set by font in the first ruleset is overridden by the second ruleset:
Copy link