Cascading Style Sheets
Subject: Computer and Technology noun /kæˈskeɪ.dɪŋ ˈstaɪl ʃiːts/ 1 definition
- web-development
- web-standards
- stylesheet-languages
- frontend-engineering
-
Definition (noun)
Entry #175 · UpdatedCascading 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
.cssfiles linked to documents via<link>elements or@importrules, 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
styleattribute, 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.cssstylesheet that adapts the page layout at@media (min-width: 768px)usingdisplay: gridandgrid-template-columns: 240px 1fr. When a sidebar link matches.nav-link[aria-current="page"], that selector's higher specificity overrides the base.nav-linkcolor rule so the active section stands out without modifying the underlying HTML.