--- url: "https://web.dev/learn/css/the-cascade" titulek: "The cascade | web.dev" h1: "The cascade Stay organized with collections Save and categorize content based on your preferences." popis: "Sometimes two or more competing CSS rules could apply to an element. In this module find out how the browser chooses which to use, and how to control this selection." jazyk: "en" kanonicka: "https://web.dev/learn/css/the-cascade" drobecky: ["web.dev", "Resources", "CSS"] zdroj: "live" wayback_snapshot: "" stazeno: "2026-09-14 02:40:26" znaku: 11073 slov: 1831 kodovani: "iso-8859-2" sha256: "4469bb35d2d7edaab0738f597c5d18ab4c72639b58ccea9d66e0ba68d77a363a" --- The cascade Stay organized with collections Save and categorize content based on your preferences. [The CSS Podcast - 004: The Cascade](https://thecsspodcast.libsyn.com/004-the-cascade) CSS stands for Cascading Stylesheets. The cascade is the algorithm for solving conflicts where multiple CSS rules apply to an HTML element. It's the reason that the text of the button styled with the following CSS will be blue. `button { color: red; } button { color: blue; }` Understanding the cascade algorithm helps you understand how the browser resolves conflicts like this. The cascade algorithm is split into 4 distinct stages. **Position and order of appearance**: the order of which your CSS rules appear **Specificity**: an algorithm which determines which CSS selector has the strongest match **Origin**: the order of when CSS appears and where it comes from, whether that is a browser style, CSS from a browser extension, or your authored CSS **Importance**: some CSS rules are weighted more heavily than others, especially with the `!important` rule type Position and order of appearance The order in which your CSS rules appear and how they appear is taken into consideration by the cascade while it calculates conflict resolution. This is the final step of the cascade, and will always result in a single winning declaration. But position is only considered if there are still conflicting styles after every other step of the cascade has been considered. The demo right at the start of this lesson is the most straightforward example of position. There are two author-origin rules without importance, both are un-layered, and come from rules that have selectors of identical specificity, so the last one to be declared won. Styles can come from various sources on an HTML page, such as a `` tag, an embedded ` Inside `styles.css`, is the following CSS rule: button { background: yellow; } What color is the button's background? pink The embedded `