In the formal syntax listed on MDN for the position property, the following are listed as possible values:
position =
static |
relative |
absolute |
sticky |
fixed |
<running()>
<running()> =
running( <custom-ident> )
Most of these are well known and listed in the current draft spec for that property on csswg.org
, except for that last one: running()
. That’s defined below, but I don’t see anything in the Value definition syntax about values with "functional" notation.
What does this mean? And, if possible, what is the intended purpose of this part of the grammar? Is this a specific extension for a specific browser or something? What is the meaning of the "functional notation" (not sure what it should be called) in the grammar in this context?
I’ve tried searching "running" on the MDN site, as well as Googling variations of "css running position", as well as Ctrl+F-ing the spec drafts on csswg.org
, but I can’t seem to find any other references to this.
There are other questions (such as this) referencing how to interpret the CSS grammar syntax, but the linked documents don’t mention this running()
function (I’ve tried both Ctrl+F-ing for running
and (
).
2
Answers
It’s in this Spec: https://www.w3.org/TR/css-gcpm-3/#running-elements
What is
running()
Its a value used for printing. As you may know css has a set of properties that enhance the way you can print a document/page and CSS is used in the context of documents. Running allows you to specify that a certain element is not to be placed on the page but rather on one of the "margins", lets say like the footer or the header.
I quote
Example:
You can read more and see more examples in the specification
IMPORTANT as you can see in the specification, this is a draft. You can read on this SO question about the usage on browsers.
Why/when would you use it
Suppose you want to make a page, such that when you print it, your page logo appears in the header and the page number appears in the footer. That’s when you need
running()
What is the meaning of the "functional notation"
In CSS they are called value functions. I quote from MDN
In short, they behave a bit like functions, in the sense that they accept parameters and return a value