tezvyn:

CSS & Design Systems

Tailwind, CSS, accessibility, design tokens

140 bites

CSS & Design Systems30 sec read

CSS 2D Transforms: Move, Rotate, and Scale Elements

CSS transforms let you move, rotate, scale, and skew elements without affecting the document's layout flow. Use it for UI animations like hover effects or modal pop-ups.

CSS & Design Systems31 sec read

CSS Transitions: Animating State Changes

CSS transitions turn abrupt style changes into smooth animations. Instead of a button's color snapping on hover, it fades gracefully. Use this for visual feedback on state changes like `:hover` or when adding classes with JavaScript.

CSS & Design Systems30 sec read

CSS clamp(): Fluid Sizing in One Line

The CSS clamp() function sets a value that scales between a minimum and maximum, like a thermostat for CSS properties. It's ideal for fluid typography, letting font-size grow with the viewport but not beyond set limits.

CSS & Design Systems30 sec read

CSS object-fit: Control How Images Fill a Box

object-fit tells an image how to behave inside a container with a different aspect ratio, preventing distortion. Use it for responsive hero images or product grids. The default is `fill`, which stretches the image; you almost always want `cover` or `contain`.

CSS & Design Systems30 sec read

Flexible Images: More Than Just `max-width`

Flexible images adapt to the device by providing different resolutions or crops. Use `srcset` for high-DPI screens and `<picture>` for art direction. The footgun is relying only on CSS `max-width`; this forces mobile users to download unnecessarily large…

CSS & Design Systems30 sec read

The Viewport Meta Tag: Your First Responsive Step

The viewport meta tag tells mobile browsers not to fake a desktop screen. It sets the page width to the device's width, enabling responsive design. It's essential for any modern site. The footgun: disabling user zoom (`user-scalable=no`) harms accessibility.

CSS & Design Systems31 sec read

CSS Container Queries: Style Components, Not Just Pages

Container queries let components respond to their own size, not the viewport's. Use them for cards or sidebars that must adapt to different layouts. The footgun: you must first declare a parent as a "containment context" with `container-type` for it to work.

CSS & Design Systems30 sec read

CSS Subgrid: Aligning Nested Grids

CSS Subgrid lets a nested grid borrow its parent's column or row tracks, solving the classic problem of aligning items inside components. This ensures elements within multiple cards, for example, line up perfectly.

CSS & Design Systems30 sec read

CSS aspect-ratio: Maintain Shape in Responsive Layouts

The `aspect-ratio` property sets a box's width-to-height ratio, making it maintain its shape as its container resizes. It's ideal for responsive video embeds or uniform grid items. The footgun: it has no effect if both width and height are fixed values.

CSS & Design Systems30 sec read

CSS minmax(): Flexible Sizing for Grid Tracks

The minmax() function gives a grid track a minimum and maximum size, like a rubber band that stretches but won't snap. Use it in CSS Grid to create columns that grow with the viewport but never shrink below a readable width.

CSS & Design Systems30 sec read

CSS Logical Properties: Layout That Speaks Every Language

Think 'start/end' not 'left/right'. CSS Logical Properties adapt your layout to the user's writing direction, from English to Arabic. Use `padding-inline-start` instead of `padding-left` for robust, internationalized sites.

CSS & Design Systems30 sec read

CSS Grid-Template-Areas: Draw Your Layout in CSS

CSS `grid-template-areas` lets you visually "draw" your layout by naming cells in a string matrix. It's ideal for defining page structures like headers and sidebars. The biggest footgun: named areas must form a perfect rectangle, or the layout breaks.

CSS & Design Systems31 sec read

CSS Grid: Placing Items on the Grid

Think of CSS Grid as a coordinate system for your layout. You can explicitly place items using line numbers or named areas, or let the browser auto-place them. This is key for page scaffolds and galleries. Footgun: Grid lines are numbered from 1, not 0.

CSS & Design Systems30 sec read

The `gap` Property: Spacing Without Margin Hacks

The `gap` property adds space *between* elements in a layout, not around them. Use it on Flexbox, Grid, or multi-column containers for clean, consistent gutters.

CSS & Design Systems30 sec read

CSS Grid: Defining a 2D Layout Container

Turn an element into graph paper with `display: grid`, making its children items you can place in rows and columns. It's ideal for page-level layouts or complex components. The footgun: grid properties only apply to direct children, not nested elements.

CSS & Design Systems30 sec read

CSS Flexbox: Mastering the Main and Cross Axis

Flexbox treats layout as a one-dimensional problem: either a row or a column. All alignment rules operate along a 'main axis' and a perpendicular 'cross axis'. Use it for navbars or card components.

CSS & Design Systems30 sec read

backdrop-filter: Styling What's Behind an Element

Think of `backdrop-filter` as frosted glass for your UI. It applies graphical effects like blur to the content *behind* an element. It's ideal for overlays like modals or navigation bars to improve legibility.

CSS & Design Systems30 sec read

CSS clip-path: Break Out of the Box

Use `clip-path` to create non-rectangular layouts by defining a visible region, like a cookie cutter for your elements. It's perfect for complex UI shapes like chevrons or circles without extra image files. The footgun: complex shapes have tricky syntax.

CSS & Design Systems30 sec read

CSS Blend Modes: Photoshop Effects in the Browser

Think Photoshop layer effects, but in CSS. Blend modes define how overlapping element colors interact—multiplying or screening them for rich effects. Use them for text knockouts on images or complex background textures.

CSS & Design Systems30 sec read

CSS Filter: Photoshop-like Effects in the Browser

The `filter` property brings Photoshop-like graphical effects directly into CSS. Use it for image adjustments like `blur()` or `contrast()`, or for complex shadows with `drop-shadow()`. The order of chained filters matters, as they are applied sequentially.