Skip to content
Sean Lynch edited this page Oct 17, 2019 · 83 revisions

Box Sizing

*, *:before, *:after {
  box-sizing: border-box;
}

or

html {
  box-sizing: border-box;
}
*, *:before, *:after {
  box-sizing: inherit;
}

Background

Masking / Clipping

  • CSS Masking
  • clip: rect(10px, 290px, 190px, 10px);
    • only supports rectangular clipping
    • element must also be position: absolute;
    • deprecated: use clip-path
    • mdn
  • clip-path: url(#clipping);
    • References <clipPath id="clipping">...</clipPath> in SVG or basic shapes like insert, circle, ellipse, and polygon
    • can be animated
    • mdn
    • caniuse
  • mask
  • mask-image
  • mask-border

Table

Flexbox

Grid

Level 2 (subgrid)

Videos

Examples

display: contents

useful with Grid and Flexbox

Float

Viewport units

position: sticky

Examples

Comma-Separated Lists

Make list items look like a real, comma-separated list:

ul > li:not(:last-child)::after {
  content: ",";
}

Use Attribute Selectors with Empty Links

Display links when the element has no text value but the href attribute has a link:

a[href^="http"]:empty::before {
  content: attr(href);
}

Change case of content

.uppercase {
  text-transform: uppercase;
}

.lowercase {
  text-transform: lowercase;
}

.capitalize {
  text-transform: capitalize;
}

Internet Explorer

Scrollbars

Remove clear "X" on text inputs

input[type=text]::-ms-clear {
  display: none;
}

input[type=text]::-ms-reveal {
  display: none;
}

Chrome

Remove clear "X" on search inputs

::-webkit-search-decoration,
::-webkit-search-cancel-button,
::-webkit-search-results-button,
::-webkit-search-results-decoration { 
  display: none; 
}

Spinners

Design ideas

Animations

2D and 3D Transforms

Colors

Icons

Examples

Resources

Clone this wiki locally