Code icon

CSS - FUNCTIONS

Links


    //CALC()
    calc(expression) Required. A mathematical expression. The result will be used as the value. The following operators can be used: + - * /

    width: 130px;             /* salvaguarda para navegadores que no reconocen calc() */
    width: calc(100% - 100px);
    width: calc(100% / 6);

    font-size: calc(var(--size) * var(--scale));

    //PATH
    clip-path: path('M0.5,1 C0.5,1,0,0.7,0,0.3 A0.25,0.25,1,1,1,0.5,0.3 A0.25,0.25,1,1,1,1,0.3 C1,0.7,0.5,1,0.5,1 Z');

    //MORE FUNCTIONS EXIST



    //MIN() MAX()
    width: min(500px, 70%); /*Looks which of this 2 values is the smallest*/
    width: max(500px, 70%); /*Looks which of this 2 values is the biggest*/
    width: max(400px, 20%, 50vh); /*Takes the biggest of the 3, last is height, yes. If the value is the biggest it takes this*/
    width: min(500px + 10%, 600px); /*With Opeartions you need to add the spaces around + - * / */


    //CLAMP()
    clamp(MIN, VAL, MAX) /*minimum value, preferred value, maximum value. */
    font-size: clamp(1rem, 2.5vw, 2rem); 
    width: clamp(300px, 50%, 20rem);  /*minimum value, preferred value, maximum value. Wants to be 50%, but minimum of 300px and maximum of 20rem */



    //PROBLEMS
    with width maybe not the best
    font size ok, but if it cannot be read