Skip to content

Main content

CSS Important Suffix Parser

Parse an unquoted top-level terminal important suffix in a balanced restricted CSS value; comments are rejected.

Loading tool…

Description

Parse an unquoted top-level terminal important suffix in a balanced restricted CSS value; comments are rejected.

CSS combines token syntax, property-specific value rules and layout/cascade processing. These are separate layers: splitting a declaration does not establish that its value is valid, and arithmetic on resolved lengths does not perform browser layout. Each tool here handles an explicit numeric representation or a stated lexical subset.

Parse an unquoted top-level terminal important suffix in a balanced restricted CSS value; comments are rejected.

When to use this tool

Use this tool to parse an unquoted top-level terminal important suffix in a balanced restricted CSS value; comments are rejected.

How to use the tool and how it works

  1. Enter value using the input definitions below.
  2. Run the operation. Resolve malformed-input errors before interpreting the result.
  3. Read result.value, result.important. Interpret signs, units, ordering and null values using the rules below.

Validate balanced comment-free lexical structure, then recognize a case-insensitive terminal top-level ! important suffix with permitted surrounding whitespace. Return its removal and important = true, otherwise trimmed value and false.1, 2

Input fieldMeaning and unitsAccepted input
valueCSS-subset value text; quoted strings and grouping follow the stated lexical rules.Text, at most 8,192 UTF-16 code units; the stated grammar and narrower limits also apply.
Output fieldInterpretation
resultObject containing the fields below.
result.valueParsed or formatted CSS-subset value string.
result.importantWhether a terminal top-level importance annotation was recognized.
json
{
  "input": {
    "value": "red ! IMPORTANT "
  },
  "output": {
    "result": {
      "value": "red",
      "important": true
    }
  }
}

Limitations and assumptions

  • Quoted or grouped text is not itself an importance annotation; this parser does not validate the property’s value grammar.
  • Lengths and times must already be resolved to consistent numeric units. Lexical helpers intentionally support smaller grammars than a full browser CSS parser; malformed supported-subset input causes an error.
  • Every declared top-level input is required and unknown fields are rejected. Ordinary strings are limited to 8,192 UTF-16 code units and lists to 128 entries, with tighter operation-specific bounds where stated. JSON text has bounded nesting and node counts.
  • Numeric outputs must be finite and within the absolute safe-integer magnitude; exact larger integers use decimal text. Source positions are zero-based UTF-16 offsets and span ends are exclusive unless a different convention is explicitly stated.

Alternative or Complementary methods

Use a full CSS parser or browser style/layout APIs when escape handling, error recovery, computed styles or the full cascade matter. These tools expose focused transformations and audits of supplied data.

References

  1. CSS Syntax Level 3 — W3C

  2. Tool behavior and example: CSS Important Suffix Parser — tool.io

Similar or alternative tools

  • CSS Important Suffix Formatter

    Replace a top-level important suffix using an explicit flag without duplicating it; restricted comment-free balanced CSS values.

  • CSS Duplicate Property Table

    Audit declaration property duplicates with ordinary ASCII property folding and case-sensitive custom-property names; not a cascade engine.