css - LESS get inheritable property value -
css - LESS get inheritable property value -
how less inheritable property value ex:
.btn { color: #000; &:after { color: darken(inherit, 15%); } }
the less compiler compiles less code static css code , not compute property value. browser utilize static css code compute value css properties.
the inherit property value reference computed value of same property of parent. @ (less) compile time reference, , computed value of parent not exist. darken() function built in of less , run @ compile time. darken() function can not have inherit input value (a color value required).
in comments @seven-phases-max tells utilize variables, code should shown below:
@buttoncolor: #000; .btn { color: @buttoncolor; &:after { color: darken(@buttoncolor, 15%); } } notice utilize of inherit property value self not forbidden in less. instance next less code compile in valid , working css code:
a { color: red; &:hover{ color: inherit; } } for same reasons 1 expect should allowed utilize inherit property value in css(3) functions, such width: calc(inherit - 2em); not possible although different reasons, see css calc inherit
css properties less
Comments
Post a Comment