diff --git a/README.md b/README.md index 4462b7b..e527557 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ smart people at [Hashrocket](http://hashrocket.com/). For a steady stream of TILs from a variety of rocketeers, checkout [til.hashrocket.com](https://til.hashrocket.com/). -_757 TILs and counting..._ +_758 TILs and counting..._ --- @@ -98,6 +98,7 @@ _757 TILs and counting..._ - [Lighten And Darken With SCSS](css/lighten-and-darken-with-scss.md) - [Make A Block Of Text Respect New Lines](css/make-a-block-of-text-respect-new-lines.md) - [Parameterized SCSS Mixins](css/parameterized-scss-mixins.md) +- [:root Has Higher Specificity Than html](css/root-has-higher-specificity-than-html.md) - [Style A Background With A Linear Gradient](css/style-a-background-with-a-linear-gradient.md) ### Devops diff --git a/css/root-has-higher-specificity-than-html.md b/css/root-has-higher-specificity-than-html.md new file mode 100644 index 0000000..ada3dae --- /dev/null +++ b/css/root-has-higher-specificity-than-html.md @@ -0,0 +1,20 @@ +# :root Has Higher Specificity Than html + +The `:root` CSS pseudo-selector and `html` will target the same element -- +``, but `:root` has higher specificity. That means the property rules +declared under `:root` will take precedence over those under `html`. + +```css +:root { + background: red; +} + +html { + background: blue; +} +``` + +In the case of the above code, the `` element's background color will +be `red`. + +[source](https://developer.mozilla.org/en-US/docs/Web/CSS/:root)