1

I'm trying to make this in pure css: Codepen

and I want to make the same thing but in css. this is my css:

.text{
  --a: calc(var(--a);*0.82+(1.5-var(--b);)/10);
  --b: calc(var(--b);+var(--a););
  transform: scale(var(--b););
}

It doesn't work. I've tried soo many things and none of them have worked. Please help!

All the information I went through to get that non working css:

CSS Variables - The var() Function

Keep Math in the CSS | CSS-Tricks

2
  • 1
    The snippet doesn't work Commented Jan 6, 2021 at 0:17
  • 2
    ^ true, + too many semicolons in CSS calc?? Commented Jan 6, 2021 at 0:30

1 Answer 1

0

First, your css code is quite messy. Semicolons (;) are used for each propery in css file. Let me fix your code

body{
  --bounce: 100; //create the variables first on parent element
  --size: 100;
}

.text{
  --bounce: calc(var(--bounce) * 0.82 + (1.5 - var(--size) / 10));
  --size: calc(var(--bounce) + var(--size));
  transform: scale(--size);
}

Please note, operator sign '+', '-', '*', and '/' must have 1 extra space between two variables or numbers.

Sign up to request clarification or add additional context in comments.

1 Comment

This doesn't work. i tried it in a temporary snippet

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.