diff --git a/snippets/not-selector.md b/snippets/not-selector.md new file mode 100644 index 000000000..067df1b49 --- /dev/null +++ b/snippets/not-selector.md @@ -0,0 +1,75 @@ +### :not selector + +The `:not` psuedo selector is useful for styling a group of elements, while leaving the last (or specified) element unstyled. + +#### HTML + +```html + +``` + +#### CSS + +```css +.css-not-selector-shortcut { + display: flex; +} + +li { + list-style-type: none; + margin: 0; + padding: 0 0.75rem; +} + +li:not(:last-child) { + border-right: 2px solid #d2d5e4; +} +``` + +#### Demo + +
+ +
+ + + +#### Explanation + +`li:not(:last-child)` specifies that the styles should apply to all `li` elements except +the `:last-child`. + +#### Browser support + +✅ No caveats. + +* https://caniuse.com/#feat=css-sel3 + +