File tree Expand file tree Collapse file tree 1 file changed +25
-2
lines changed Expand file tree Collapse file tree 1 file changed +25
-2
lines changed Original file line number Diff line number Diff line change 2
2
3
3
A collection of tips to help take your CSS skills pro.
4
4
5
+ 1 . [ Use ` :not() ` to Apply/Unapply Borders on Navigation] ( #use-not-to-applyunapply-borders-on-navigation )
6
+ 1 . [ Add Line-Height to ` body ` ] ( #add-line-height-to-body )
7
+ 1 . [ Vertically Center Anything] ( #vertically-center-anything )
8
+ 1 . [ Select Items Using Negative ` nth-child ` ] ( #select-items-using-negative-nth-child )
9
+ 1 . [ Use SVG for Icons] ( #use-svg-for-icons )
10
+ 1 . [ Inherit ` box-sizing ` ] ( #inherit-box-sizing )
11
+ 1 . [ Get Rid of Margin Hacks With Flexbox] ( #get-rid-of-margin-hacks-with-flexbox )
12
+
5
13
6
14
### Use ` :not() ` to Apply/Unapply Borders on Navigation
7
15
@@ -36,12 +44,12 @@ body {
36
44
You don't need to add ` line-height ` to each ` <p> ` , ` <h*> ` , _ et al_ . separately. This way textual elements can inherit from ` body ` easily.
37
45
38
46
39
- ### Vertically/Horizontally Center Anything
47
+ ### Vertically Center Anything
40
48
41
49
``` css
42
50
html , body {
43
- margin : 0 ;
44
51
height : 100% ;
52
+ margin : 0 ;
45
53
}
46
54
47
55
body {
@@ -82,6 +90,21 @@ Use negative `nth-child` in CSS to select items 1 through n. Well that was prett
82
90
There's no reason not to use SVG for icons. SVG is supported in all browsers back to IE9. So start ditching your .png, .jpg, or .gif-jif-whatev files.
83
91
84
92
93
+ ### Inherit ` box-sizing `
94
+
95
+ ``` css
96
+ html {
97
+ box-sizing : border-box ;
98
+ }
99
+ * , * :before , * :after {
100
+ box-sizing : inherit ;
101
+ }
102
+
103
+ ```
104
+
105
+ Letting ` box-sizing ` be inheritted from ` html ` makes it easier to change ` box-sizing ` in plugins or other components that leverage other behavior.
106
+
107
+
85
108
### Get Rid of Margin Hacks With Flexbox
86
109
87
110
``` css
You can’t perform that action at this time.
0 commit comments