Snippets about css

9 snippets

Back to all snippets

  1. SNP 111 #25B

    Sweetie 16 as CSS variables

    The palette this site is coloured with, ready to paste into a stylesheet.

  2. SNP 101 #B63

    Dynamic Tailwind classes in Stati

    A class built from a variable never reaches Tailwind's scanner, unless stati.propValue() writes it down.

  3. SNP 090 #B13

    Anchors hidden under a sticky header

    Clicking a table of contents link scrolls the heading right under your fixed header. One property fixes it.

  4. SNP 082 #135

    Fluid font sizes with clamp

    A heading that grows with the viewport between a minimum and a maximum, no media queries.

  5. SNP 063 #13B

    Class names with stati.propValue

    Stati's own classnames, for class lists with conditions in them.

  6. SNP 048 #31B

    Truncate text after a few lines

    Clamp a description to three lines with an ellipsis, in CSS only.

  7. SNP 045 #164

    Respect prefers-reduced-motion

    Some people get dizzy from your fancy animations. The browser tells you who, so listen.

  8. SNP 040 #14B

    Hide the scrollbar but keep scrolling

    For horizontal carousels and tab bars where the scrollbar is just noise.

  9. SNP 026 #513

    Crisp pixel art in CSS

    Browsers smooth scaled images by default, which turns pixel art into mush. One line fixes it.