I was looking at the use of variables in CSS, as below, simple thing, so far so good. Then I saw that I could incorporate 'functions', but I only saw it using libs like lesscss and sass .
Is it possible to define a function in CSS - like the last 2 examples - without having to resort to the installed libs?
It would make it easier to maintain the style sheet than to have to define several classes to elements, type <div class="azul borda maiusculo">Lorem ipsum</div>
.
:root {
--preto:#000;
--cinza:#999;
}
h1{color:var(--preto)}
h2{color:var(--cinza)}
<h1>Lorem ipsum</h1>
<h2>Lorem ipsum</h2>
.classH1(@color: red, @size: 16px){
font-size:@size;
border:@color 2px solid;
}
h1{
.classH1(green, 20px);
}
.classH1(){
font-size:10;
border:#000 2px solid;
}
h1{
.classH1();
}