File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ smart people at [Hashrocket](http://hashrocket.com/).
1010For a steady stream of TILs from a variety of rocketeers, checkout
1111[ til.hashrocket.com] ( https://til.hashrocket.com/ ) .
1212
13- _ 757 TILs and counting..._
13+ _ 758 TILs and counting..._
1414
1515---
1616
@@ -98,6 +98,7 @@ _757 TILs and counting..._
9898- [ Lighten And Darken With SCSS] ( css/lighten-and-darken-with-scss.md )
9999- [ Make A Block Of Text Respect New Lines] ( css/make-a-block-of-text-respect-new-lines.md )
100100- [ Parameterized SCSS Mixins] ( css/parameterized-scss-mixins.md )
101+ - [ : root Has Higher Specificity Than html] ( css/root-has-higher-specificity-than-html.md )
101102- [ Style A Background With A Linear Gradient] ( css/style-a-background-with-a-linear-gradient.md )
102103
103104### Devops
Original file line number Diff line number Diff line change 1+ # : root Has Higher Specificity Than html
2+
3+ The ` :root ` CSS pseudo-selector and ` html ` will target the same element --
4+ ` <html> ` , but ` :root ` has higher specificity. That means the property rules
5+ declared under ` :root ` will take precedence over those under ` html ` .
6+
7+ ``` css
8+ :root {
9+ background : red ;
10+ }
11+
12+ html {
13+ background : blue ;
14+ }
15+ ```
16+
17+ In the case of the above code, the ` <html> ` element's background color will
18+ be ` red ` .
19+
20+ [ source] ( https://developer.mozilla.org/en-US/docs/Web/CSS/:root )
You can’t perform that action at this time.
0 commit comments