question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`calc` with square brackets doesn't work

See original GitHub issue

Reproduction link

Put the below code in Template part of https://vueuse-playground.netlify.app

<div class="h-300px dark:text-white bg-gray-400">
  <div class="h-[calc(100%+1rem)] bg-red-500">
    Text
  </div>
</div>

Reference from Windi post

Steps to reproduce

  1. See in the Preview
  2. Background doesn’t turn to red
  3. Inspect in the console Screen Shot 2021-06-05 at 15 58 06

What is expected?

Utility is properly generated.

What is happening?

Utility is not properly generated.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
ydcjeffcommented, Jun 7, 2021

Whitespace is required for + and -, but not for * and /. But it is recommended to add whitespace for consistency. MDN Ref

So I think showing autocompletion for calc with _ would solve this issue.

3reactions
voorjaarcommented, Jun 7, 2021

It’s interesting, I found that the expression only works if you add spaces to the calc. such as height: calc(100% + 1rem). You can temporarily use h-[calc(100%_+_1rem)], _ will be replaced with a space. It’s actually a css bug.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Should a 'Calculator' support '{' (curly braces) and '[' (box braces)
My reason for asking: The pros of the 1st approach (and cons of the 2nd) are: It makes it easier to read the...
Read more >
How do you put in brackets in a calculator not ( ) these - Fixya
For curly braces {} use 2ND ( and 2ND ). For square brackets [] use 2ND multiply and 2ND plus.
Read more >
PowerToys run calculator not working w/ parentheses #17595
Calculator function to return 1, or evaluate whatever expression that has parentheses to evaluate as you would naturally expect. ❌ Actual ...
Read more >
10 Common Errors when Using the TI-84 Plus Calculator
1. If you press [–] instead of [(-)] at the beginning of an entry, the calculator assumes you want to subtract what comes...
Read more >
I just used your equation calculator and now I am more ...
three plus two "OPEN SQUARE BRACKET" times ten "OPEN PARENTHESES BRACKET" ... I don't know why that happened, but it really doesn't matter....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found