> For AI agents: the complete documentation index is available at /next/llms.txt, the full documentation bundle is available at /next/llms-full.txt.

# CSS

This page documents the `CSS` CDP domain supported by Lynx DevTool.



:::warning Experimental reference
This generated reference is still being completed.

- CDP events are not included yet.
- Some Lynx extensions are listed but do not yet have detailed documentation.
- Method descriptions are not automatically verified against the implementation and may be incomplete or inaccurate.

Verify behavior against the implementation and the linked upstream CDP reference before relying on it.
:::

## Overview

- Scope: `instance`
- CDP domain: [CSS](https://chromedevtools.github.io/devtools-protocol/tot/CSS/)

## Standard Methods

- [CSS.addRule](https://chromedevtools.github.io/devtools-protocol/tot/CSS/#method-addRule)
- [CSS.createStyleSheet](https://chromedevtools.github.io/devtools-protocol/tot/CSS/#method-createStyleSheet)
- [CSS.disable](https://chromedevtools.github.io/devtools-protocol/tot/CSS/#method-disable)
- [CSS.enable](https://chromedevtools.github.io/devtools-protocol/tot/CSS/#method-enable)
- [CSS.getBackgroundColors](https://chromedevtools.github.io/devtools-protocol/tot/CSS/#method-getBackgroundColors)
- [CSS.getComputedStyleForNode](https://chromedevtools.github.io/devtools-protocol/tot/CSS/#method-getComputedStyleForNode)
- [CSS.getInlineStylesForNode](https://chromedevtools.github.io/devtools-protocol/tot/CSS/#method-getInlineStylesForNode)
- [CSS.getLayersForNode](https://chromedevtools.github.io/devtools-protocol/tot/CSS/#method-getLayersForNode)
- [CSS.getMatchedStylesForNode](https://chromedevtools.github.io/devtools-protocol/tot/CSS/#method-getMatchedStylesForNode)
- [CSS.getMediaQueries](https://chromedevtools.github.io/devtools-protocol/tot/CSS/#method-getMediaQueries)
- [CSS.getStyleSheetText](https://chromedevtools.github.io/devtools-protocol/tot/CSS/#method-getStyleSheetText)
- [CSS.setMediaText](https://chromedevtools.github.io/devtools-protocol/tot/CSS/#method-setMediaText)
- [CSS.setStyleSheetText](https://chromedevtools.github.io/devtools-protocol/tot/CSS/#method-setStyleSheetText)
- [CSS.setStyleTexts](https://chromedevtools.github.io/devtools-protocol/tot/CSS/#method-setStyleTexts)
- [CSS.setSupportsText](https://chromedevtools.github.io/devtools-protocol/tot/CSS/#method-setSupportsText)
- [CSS.startRuleUsageTracking](https://chromedevtools.github.io/devtools-protocol/tot/CSS/#method-startRuleUsageTracking)
- [CSS.stopRuleUsageTracking](https://chromedevtools.github.io/devtools-protocol/tot/CSS/#method-stopRuleUsageTracking)

## Lynx Extensions

### `CSS.updateRuleUsageTracking`

Records selectors that should be marked as used by the Lynx CSS rule usage tracker.

- Origin: `lynx-extension`
- Source: `devtool/lynx_devtool/agent/domain_agent/inspector_css_agent_ng.cc`

###### Parameters

| Name         | Type     | Required | Description                                                                                                           |
| ------------ | -------- | -------- | --------------------------------------------------------------------------------------------------------------------- |
| `selector`   | `array`  | No       | Selector strings to add to the current CSS rule usage set while CSS rule usage tracking is active.                    |
| `selector[]` | `string` | Yes      | Selector text. The native handler stores the string as-is and later searches for it in the generated stylesheet text. |

###### Returns

No return fields.

###### Notes

- Dispatches through LynxDevToolMediator to InspectorTasmExecutor on the TASM thread.
- This method is only effective after CSS.startRuleUsageTracking has enabled rule usage tracking.
- The handler inserts each params.selector item into an in-memory selector set and does not send a CDP response.
- CSS.stopRuleUsageTracking later emits the collected selectors as ruleUsage entries. Each entry contains styleSheetId, startOffset, endOffset, and used.
- When CSS.stopRuleUsageTracking runs with no selectors collected by this method, Lynx falls back to collecting id and class selector usage from the DOM tree.

###### Examples

**Mark selectors as used during tracking**

Request:

```json
{
  "id": 1,
  "method": "CSS.updateRuleUsageTracking",
  "params": {
    "selector": ["#app", ".title"]
  }
}
```

