Custom Property inherit vs initial

Custom-property initial is guaranteed-invalid unless registered with supplied initial token; inherit uses parent independently computed value, not ordinary property default. Explicit supplied computed/layout context only; not a browser cascade/layout engine or cross-browser guarantee.

Description

An unregistered custom property's initial value is guaranteed-invalid.

An unregistered custom property's initial value is guaranteed-invalid.1

A registered property's initial value and inheritance depend on its declared registration context. Use Custom Property inherit vs initial to evaluate the supplied inputs under the specific model below.

When to use Custom Property inherit vs initial

Use Custom Property inherit vs initial to evaluate the supplied inputs under the specific model below. Define the supplied layout, token or rendering scenario and establish the relevant units and browser context independently.

How to use Custom Property inherit vs initial and understand its results

  1. Define the supplied layout, token or rendering scenario and establish the relevant units and browser context independently.
  2. Enter Keyword, Is registered, Caller parent computed token, Caller registered initial token using the field table and validation rules below, then run the tool.
  3. Read Resolved custom property token, Guaranteed invalid and interpret units, signs, ordering and placeholders as explained below.
  4. If the tool reports an input error, correct that field and rerun. A successful false result, empty match list or unknown-evidence placeholder has the specific meaning described here; check the limitations before applying the result.
Input fieldMeaningValue typeRequirement
keywordKeywordstringRequired; constraints below
isRegisteredIs registeredbooleanRequired; constraints below
callerParentComputedTokenCaller parent computed tokenstringRequired; constraints below
callerRegisteredInitialTokenCaller registered initial tokenstringRequired; constraints below

Enter exactly inherit or initial, a registration boolean and parent and registered-initial token strings. inherit returns the supplied parent value. initial returns the registered initial value when registered, otherwise an empty-string placeholder with the guaranteed-invalid flag true. The empty string represents this result state rather than a valid empty CSS value. No registration syntax or full cascade is evaluated.

inherit→parent; registered initial→registeredInitial; unregistered initial→guaranteed-invalid placeholder

Field order, units and branch conditions follow the implementation explanation above.

Output fieldMeaningValue type
resolvedCustomPropertyTokenResolved custom property tokenstring
guaranteedInvalidGuaranteed invalidboolean
json
{
  "input": {
    "keyword": "initial",
    "isRegistered": false,
    "callerParentComputedToken": "red",
    "callerRegisteredInitialToken": "blue"
  },
  "output": {
    "resolvedCustomPropertyToken": "",
    "guaranteedInvalid": true
  }
}

Limitations and assumptions

An unregistered custom property’s initial value is guaranteed-invalid. The flag distinguishes that state from the tool’s empty-string output placeholder.2

A registered property's initial value and inheritance depend on its declared registration context. Apply the exact scope and assumptions described above.

All listed fields require explicit values. Unexpected fields, incorrect types, nonfinite numbers and sparse arrays fail validation. Domain-specific bounds, alignments and supported tokens are stated above; extremely large inputs or outputs can also be rejected. These errors differ from successful results such as false, no matches or unknown evidence.

Alternative or Complementary methods

Use all:unset Reset Behavior Lookup for a related task: All unset applies inheritance or initial-value behavior with defined exclusions.

Use inherit/initial/unset/revert Resolution Table for a related task: CSS-wide keywords choose parent, initial or rollback values under defined rules.

References

  1. Custom Property inherit vs initial — tool.io

  2. CSS Custom Properties for Cascading Variables — W3C

Similar or alternative tools

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies