Skip to content

Commit ba4d2f0

Browse files
Add TOC and new tip 🎉
1 parent b889f63 commit ba4d2f0

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

‎README.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
A collection of tips to help take your CSS skills pro.
44

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+
513

614
### Use `:not()` to Apply/Unapply Borders on Navigation
715

@@ -36,12 +44,12 @@ body {
3644
You don't need to add `line-height` to each `<p>`, `<h*>`, _et al_. separately. This way textual elements can inherit from `body` easily.
3745

3846

39-
### Vertically/Horizontally Center Anything
47+
### Vertically Center Anything
4048

4149
```css
4250
html, body {
43-
margin: 0;
4451
height: 100%;
52+
margin: 0;
4553
}
4654

4755
body {
@@ -82,6 +90,21 @@ Use negative `nth-child` in CSS to select items 1 through n. Well that was prett
8290
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.
8391

8492

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+
85108
### Get Rid of Margin Hacks With Flexbox
86109

87110
```css

0 commit comments

Comments
 (0)