--- id: css-syntax title: "CSS Syntax" category: "Frontend" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["CSS rule", "CSS declaration", "selector and declaration block", "CSS property value", "CSS rule syntax"] duplicate_of: "" source_trust_level: "B" confidence_score: 0.9 created_at: 2026-06-23 updated_at: 2026-06-23 review_reason: "" merge_history: [] tags: ["css", "web", "frontend", "w3schools", "syntax"] raw_sources: ["https://www.w3schools.com/css/css_syntax.asp"] applied_in: [] github_commit: "" --- # [[CSS Syntax]] ## π― ν μ€ ν΅μ°° (One-line insight) A CSS rule is made of a selector that points to the HTML element to style and a declaration block containing one or more `property: value;` declarations, separated by semicolons and surrounded by curly braces. [S1] ## π§ ν΅μ¬ κ°λ (Core concepts) - **A CSS rule has two parts** β a selector and a declaration block. [S1] - **Selector** β points to the HTML element you want to style. [S1] - **Declaration block** β contains one or more declarations separated by semicolons. [S1] - **Declaration** β includes a CSS property name and a value, separated by a colon. [S1] - **Punctuation** β multiple CSS declarations are separated with semicolons, and declaration blocks are surrounded by curly braces. [S1] ## π§© μΆμΆλ ν¨ν΄ (Extracted patterns) - **Rule pattern** β `selector { property: value; property: value; }`. [S1] - **Declaration pattern** β each declaration pairs a property and a value with a colon: `property: value;`. [S1] ## π μΈλΆ λ΄μ© (Details) A CSS rule consists of a **selector** and a **declaration block**. [S1] The selector points to the HTML element you want to style. The declaration block contains one or more declarations separated by semicolons. Each declaration includes a CSS property name and a value, separated by a colon. Multiple CSS declarations are separated with semicolons, and declaration blocks are surrounded by curly braces. [S1] **Example** [S1] ```css p { color: red; text-align: center; } ``` In this example: [S1] - `p` is the selector (it targets HTML `
` paragraph elements). - `color` is a property, and `red` is its value. - `text-align` is a property, and `center` is its value. The rule above makes all paragraph text red and center-aligned. [S1] ## π οΈ μ μ© μ¬λ‘ (Applied in summary) The `p` rule above is the page's own applied example: a complete rule styling paragraph elements with `color` and `text-align`. No external project/commit applications found in the source. ## π» μ½λ ν¨ν΄ (Code patterns) Basic CSS rule structure (language: CSS): ```css selector { property: value; property: value; } ``` Concrete example: ```css p { color: red; text-align: center; } ``` ## βοΈ λͺ¨μ λ° μ λ°μ΄νΈ (Contradictions & updates) No contradictions found in the source. ## β κ²μ¦ μν λ° μ λ’°λ - **μν:** draft - **κ²μ¦ λ¨κ³:** conceptual (μ€μ μ μ© μ¬λ‘ λ°κ²¬ μ applied/validatedλ‘ μΉκ²© κ°λ₯) - **μΆμ² μ λ’°λ:** B (W3Schools β widely used educational reference, not a primary standards body) - **μ λ’° μ μ:** 0.9 - **μ€λ³΅ κ²μ¬ κ²°κ³Ό:** μ κ· μμ± (New discovery) ## π μ§μ κ·Έλν (Knowledge Graph) - **μμ/루νΈ:** [[CSS Tutorial]] - **κ΄λ ¨ κ°λ :** [[CSS Introduction]], [[CSS Selectors]], [[CSS Add Internal]] - **μ°Έμ‘° λ§₯λ½:** The grammar underlying every CSS rule; referenced whenever writing or reading any selector and declaration. ## π μΆμ² (Sources) - [S1] W3Schools β CSS Syntax β https://www.w3schools.com/css/css_syntax.asp ## π λ³κ²½ μ΄λ ₯ (Change history) - 2026-06-23: Initial draft synthesized from the W3Schools "CSS Syntax" page (Astra wiki-curation, P-Reinforce v3.1 format).