Skip to content

Misleading text in calc() doc #22805

Closed
@jharrilim

Description

@jharrilim

MDN URL

https://developer.mozilla.org/en-US/docs/Web/CSS/calc

What specific section or headline is this issue about?

The first paragraph

What information was incorrect, unhelpful, or incomplete?

The statement:

It can be used anywhere a <length>, <frequency>, <angle>, <time>, <percentage>, <number>, or <integer> is allowed.

There is a caveat in which calc() cannot be used as a number. If we take a look at the syntax for percentage, we'll see that it states:

The <percentage> data type consists of a <number> followed by the percentage sign (%).

If you were to try to substitute <number> with a calc expression, such as:

.class {
  background-position: calc(100 / 200 * 3)%;
}

It would not be valid.

What did you expect to see?

A mention of this caveat, and likely the removal of the word "anywhere".

Do you have any supporting links, references, or citations?

https://developer.mozilla.org/en-US/docs/Web/CSS/percentage#syntax

Do you have anything more you want to share?

No response

MDN metadata

Page report details

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions