Skip to main content
Definition Website Computer and Technology

Cascading Style Sheets

Subject: Computer and Technology noun /kæˈskeɪ.dɪŋ ˈstaɪl ʃiːts/ 1 definition

  1. Definition (noun)

    Entry #175 · Updated

    Cascading Style Sheets (CSS) is a declarative stylesheet language standardized by the World Wide Web Consortium (W3C) for defining the visual presentation and layout of structured documents written in markup languages such as HTML, SVG, and XML. It works by matching rule sets—comprising selectors and property-value declarations—against elements in the document tree, while its cascade algorithm resolves conflicting declarations across browser defaults, user preferences, and author stylesheets by origin, specificity, and source order. By separating presentation concerns from semantic document structure (handled by markup) and dynamic behavior (handled by scripting languages such as JavaScript), CSS enables consistent styling, accessibility, and responsive adaptation across diverse viewports and output media.

    Common Forms

    • External Stylesheets: Standalone .css files linked to documents via <link> elements or @import rules, enabling shared styling across multiple pages and efficient browser caching.

    • Internal Stylesheets: Rule sets embedded inside a <style> element within a document's <head> or a Shadow DOM tree, scoping styles to a single document or component without extra network requests.

    • Inline Styles: Property-value declarations written directly in an element's style attribute, applying targeted per-element styling that overrides normal author declarations in the cascade.

    • User-Agent Stylesheets: Built-in default stylesheets supplied by web browsers that establish baseline formatting—such as margins, font weights, and display modes—before any author rules take effect.

    Example

    A frontend team builds a responsive documentation portal by linking an external theme.css stylesheet that adapts the page layout at @media (min-width: 768px) using display: grid and grid-template-columns: 240px 1fr. When a sidebar link matches .nav-link[aria-current="page"], that selector's higher specificity overrides the base .nav-link color rule so the active section stands out without modifying the underlying HTML.