大网数据广告活动
Web 标准与前端开发

CSS syntax

· 52CE 我爱测

The **CSS syntax** module describes, in general terms, the structure and syntax of cascading stylesheets, or CSS. It defines CSS as the language for describing the rendering of structured documents (such as HTML and XML), on the web and elsewhere.

The CSS syntax module describes, in general terms, the structure and syntax of cascading stylesheets, or CSS. It defines CSS as the language for describing the rendering of structured documents (such as HTML and XML), on the web and elsewhere.

This module doesn't define any properties, data types, functions, or at-rules. Rather, it elaborates on how all of these features should be defined and how user agents should parse CSS.

Reference

At-rules and descriptors

  • none

[!NOTE] The module explicitly states that @charset is not an actual at-rule, but rather an unrecognized legacy rule that should be omitted when a stylesheet is grammar-checked. The only valid @charset usage is at the very beginning of a stylesheet, where it is interpreted as a special byte sequence stripped before processing the content.

Key concepts

Glossary terms

  • CSS descriptor
  • Parse
  • Style sheet
  • Whitespace

Guides

Related concepts

CSS selectors module:

CSS cascading and inheritance module:

CSS custom properties for cascading variables module:

CSS conditional rules module:

  • @media at-rule
  • @supports at-rule

CSS Object Model (CSSOM) API:

  • CSSValue.cssText property
  • CSSStyleSheet.insertRule() method
  • CSSStyleSheet.replace() method

WHATWG specification:

  • style element
  • link element
  • class attribute
  • rel attribute

Specifications

See also

来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
MDN Web Docs / Mozilla 贡献者
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 2.5

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。