I set the display property for divs to in
line-block
. I then created four classes:
- no-var, which sets display to
inherit
- var, which sets display to a variable set to
inherit
- var-none, which sets display to a variable set to
none
- var-default, which sets display to a variable set to
inherit
and a default ofgrid
The actual style that is used by each class doesn't seem to be correct, though:
- The no-var class correctly inherits display to
block
- The var class doesn't get the
inherit
value from the variable and displays asinline-block
- The var-none class correctly sets display to
none
and is hidden - The var-default class doesn't get the
inherit
value from the variable and sets display to the default
For each of these classes I added variables and defaults for the color property, which all work as expected. Are variables supposed to ignore inherit
and unset
values?
:root {
--display: inherit;
--display-none: none;
--color: red;
}
div {
display: inline-block;
color: green;
}
.no-var {
display: inherit;
color: red;
}
.var {
display: var(--display);
color: var(--color);
}
.var-none {
display: var(--display-none);
}
.var-default {
display: var(--display, grid);
color: var(--color, purple);
}
<div class="no-var">
No variable
</div>
<div class="no-var">
No variable
</div>
<div class="var">
Variable
</div>
<div class="var">
Variable
</div>
<div class="var-none">
None
</div>
<div class="var-none">
None
</div>
<div class="var-default">
Default
</div>
<div class="var-default">
Default
</div>