Tag: UI Design

  • CSS Border Radius Generator: Per-Corner & Blob [2026]

    CSS Border Radius Generator: Per-Corner & Blob [2026]

    TL;DR: A CSS border radius generator builds rounded-corner styles visually — uniform corners, per-corner radii, or organic “blob” shapes via the elliptical syntax. Modern UI uses 8-16px on cards, 6-10px on buttons, 999px (or 50%) for fully rounded pills. Our free generator produces both the 4-value and 8-value (elliptical) syntaxes with live preview.

    Border radius is the design primitive that shifted UIs from sharp corners (1995-2010) to soft corners (2010-now) and is now the difference between “modern” and “dated” interfaces. Get the value right and your card looks polished; get it wrong and it looks like a bootstrap default. Most CSS border-radius generators only show the simple uniform-corner case; the interesting work is per-corner control and the rarely-used elliptical syntax that produces organic blob shapes.

    Our CSS border radius generator handles all three modes — uniform, per-corner, and elliptical — with a live preview and copy-ready CSS. This guide explains the right values for each UI element, the elliptical syntax that produces blob shapes, and the framework-specific shortcuts.

    Standard border-radius values for UI elements

    Element Recommended radius Notes
    Cards 8-16 px Stripe and Linear use 12px; Apple HIG uses 14px
    Buttons 6-10 px Pills (999 px) for marketing CTAs
    Form inputs 4-8 px Match your buttons to keep visual rhythm
    Avatars 50% (perfect circle) Or 999px which works the same on small elements
    Tags / chips 999 px (pill) Modern look; 4 px reads as old-school
    Modals / dialogs 12-20 px Slightly softer than cards for visual hierarchy
    Code blocks 6-10 px Match cards or buttons in your design system

    The “design system rhythm” rule: use 2-3 distinct radius values across your UI, not one per component. A typical system: 6 px (form inputs, small buttons), 12 px (cards, tags-as-rectangles), 999 px (pills, avatars, dots). Inconsistent radii (6/8/10/14 mixed across components) reads as unintentional.

    Per-corner border radius — when uniform won’t do

    /* Uniform — all four corners */
    border-radius: 12px;
    
    /* Per-corner: top-left, top-right, bottom-right, bottom-left */
    border-radius: 12px 12px 0 0;       /* card with attached top */
    border-radius: 0 12px 12px 0;       /* tab attached to left side */
    border-radius: 12px 12px 12px 4px;  /* speech-bubble pointer */

    Per-corner control is essential for tabs, speech bubbles, attached cards, and any element that visually “connects” to another. The 4-value shorthand follows the same clockwise order as padding and margin — top, right, bottom, left.

    Elliptical border radius — the blob shape secret

    The 8-value border-radius syntax produces elliptical corners, which when used asymmetrically across corners creates organic “blob” shapes:

    /* The full syntax: horizontal-radii / vertical-radii */
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    /*              ^---horizontal--^   ^----vertical---^
       tl, tr, br, bl                 tl, tr, br, bl  */

    Each corner gets two radii (horizontal + vertical), making the corner an ellipse rather than a circle. When the values are deliberately asymmetric, the result reads as organic / hand-drawn — useful for hero illustrations, decorative shapes, and modern “blob” backgrounds. Our generator includes a “blob” mode that randomises asymmetric values for instant organic shapes.

    How to use the browser border radius generator

    1. Open the CSS border radius generator
    2. Pick a mode: Uniform (one slider for all four corners), Per-corner (4 sliders), or Blob (8 values, randomisable)
    3. Drag sliders to shape the preview
    4. Toggle preset (Card, Pill, Avatar, Tab-left, Tab-right, Speech bubble, Blob)
    5. Copy CSS or Tailwind utility output

    Tailwind CSS shortcuts

    rounded-none    /* 0 */
    rounded-sm      /* 2px */
    rounded         /* 4px */
    rounded-md      /* 6px */
    rounded-lg      /* 8px */
    rounded-xl      /* 12px */
    rounded-2xl     /* 16px */
    rounded-3xl     /* 24px */
    rounded-full    /* 9999px */
    
    /* Per-corner */
    rounded-t-lg                    /* top-left + top-right */
    rounded-tl-lg                   /* top-left only */
    rounded-tl-2xl rounded-br-2xl   /* mixed corners */

    Common mistakes

    • Same radius on small + large elements. 8 px reads tight on a small button but looks dated on a large card. Scale radius with element size — small (6 px), medium (10-12 px), large (14-16 px).
    • Forgetting that border-radius: 50% only gives a circle on square elements. On a rectangle, 50% produces an ellipse. For pills, use border-radius: 999px.
    • Inheriting from images on overflow. If a child image overflows a parent with rounded corners, set overflow: hidden on the parent or apply the same border-radius to the image directly.
    • Inconsistent radii across the design system. Pick 2-3 standard values and use them everywhere. Random radii read as unintentional.

    Frequently asked questions

    What’s the difference between border-radius and clip-path for rounded shapes?

    border-radius rounds the corners of the element’s box. clip-path can produce arbitrary shapes (polygons, circles, complex paths). For simple rounding, border-radius is faster (GPU-accelerated, fewer paint cycles). For non-rectangular shapes (heart, star, custom polygon), clip-path is the right tool. They can be combined — a rounded element clipped to a custom path.

    Can I animate border-radius?

    Yes — border-radius animates smoothly via CSS transitions and keyframes. Browsers handle this efficiently. Common use: card hover states that morph from rectangle to slightly-rounded as a “lifted” effect.

    Why do my rounded images have sharp corners?

    Two common causes: (1) the parent has rounded corners but doesn’t have overflow: hidden, so the image overflows; (2) you applied border-radius to the parent but not the image directly. Fix: either apply overflow: hidden + border-radius to the parent, or border-radius directly to the image.

    What’s a good radius for a button?

    6-10 px for standard buttons matches modern design systems (Stripe, Linear, Apple HIG). Pills (999 px or rounded-full) for marketing CTAs and tags. The same value across all your buttons in a design system; don’t vary.

    Will the generator output match the preview exactly?

    Yes — the preview and the generated CSS are computed from the same values. Drop the CSS into your stylesheet and you get pixel-identical results.

    Is my data sent anywhere?

    No. The generator runs entirely in your browser. Slider values, preview, and CSS output stay on your device.

    Related tools and guides

     

  • CSS Box Shadow Generator: Multi-Layer Depth [2026]

    CSS Box Shadow Generator: Multi-Layer Depth [2026]

    TL;DR: A CSS box shadow generator builds box-shadow declarations visually — drag offset, blur, spread, and colour sliders to design the shadow, copy the CSS. Modern UI uses multi-layer shadows (2-3 stacked) for realistic depth: a tight close shadow for grounding plus a soft far shadow for ambient. Our free generator handles inset, multi-layer stacks, and exports paste-ready CSS or Tailwind utilities.

    Shadows are the lazy designer’s depth cue. Drop a 4-pixel grey shadow under any card and the card looks “lifted” off the page. Drop the wrong shadow and the card looks like it’s from 2015. The difference between professional and amateur UI in 2026 isn’t whether you use shadows — it’s whether you stack two or three layers to mimic how real light works. A box-shadow generator with multi-layer support is the fastest way to get there.

    Our CSS box shadow generator ships with a live preview, multi-layer support, inset toggle, and export as either vanilla CSS or Tailwind arbitrary-value classes. This guide explains the five box-shadow parameters, why multi-layer shadows look more realistic than single-layer ones, the modern Material Design 3 elevation tokens, and the performance gotchas that make heavy-shadow pages laggy on mobile.

    The five parameters that define a box-shadow

    Parameter Effect Typical range
    Horizontal offset (x) Shadow shifted right (positive) or left (negative) −2 to 2 px (subtle), 0 for centred
    Vertical offset (y) Shadow shifted down (positive) — typical for “lifted” cards 2-30 px depending on elevation
    Blur radius How soft / diffuse the shadow edge is 2× the y-offset for natural softness
    Spread Expands or contracts the shadow before blur. Negative = tight; positive = halo −10 to 5 px typically
    Colour Shadow’s RGBA value rgba(0,0,0,0.04-0.18) for natural shadows

    The single most common mistake: using rgba(0,0,0,0.5) for the shadow colour. Real shadows are far more subtle — 0.04 to 0.18 alpha is the right range. Heavy shadows look like a 2008 web aesthetic. Use multi-layer composition for depth, not a single dark shadow.

    Multi-layer shadows — the modern technique

    Single shadows look flat. Real-world depth has two characteristics: a tight close shadow (the ambient occlusion right next to the object) and a soft far shadow (the diffused fall-off). Modern UI mimics this by stacking 2-3 shadow layers in one box-shadow declaration:

    /* Single shadow (looks flat) */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    
    /* Two-layer (realistic depth) */
    box-shadow:
      0 1px 2px 0 rgba(10, 37, 64, 0.04),     /* close, tight */
      0 4px 12px -2px rgba(10, 37, 64, 0.08); /* far, soft */
    
    /* Three-layer (premium look — Stripe, Linear, Vercel use this) */
    box-shadow:
      0 1px 1px 0 rgba(10, 37, 64, 0.05),
      0 2px 4px -1px rgba(10, 37, 64, 0.08),
      0 12px 24px -8px rgba(10, 37, 64, 0.12);

    The progression from one to three layers is what separates default-looking buttons from premium-looking buttons. Most modern design systems (Material 3, Apple HIG, Tailwind’s shadow-xl) ship multi-layer shadows out of the box.

    Material Design elevation system — six standard levels

    Material Design’s elevation system maps real-world depth to six numerical levels. Each level uses a specific multi-layer shadow stack tuned for the apparent height. Useful as a starting point for your own design system:

    • Elevation 0: no shadow (flat surfaces, page background)
    • Elevation 1: subtle lift (cards at rest, table rows)
    • Elevation 2: raised (cards on hover, primary buttons)
    • Elevation 3: floating (FABs, contextual menus)
    • Elevation 4: overlaid (dialogs, drawers)
    • Elevation 5: very prominent (modal cover, navigation drawer)

    Pick three or four of these for your design system rather than letting designers invent custom shadows per component. Consistency is what makes a UI look polished.

    How to use the browser box-shadow generator

    1. Open the box shadow generator
    2. Drag the x, y, blur, spread sliders. Watch the live preview update
    3. Adjust the colour picker (alpha matters — keep it subtle)
    4. Toggle inset for inner shadows (useful for pressed-button states or “carved” effects)
    5. Click + Add layer to stack a second or third shadow for realistic depth
    6. Pick a preset (Material elevations 1-5, “Stripe-style” multi-layer, “carved”, “neon glow”)
    7. Copy CSS or Tailwind output

    Performance — when shadows hurt page speed

    Shadows are GPU-rendered, which is fast — but not free. A handful of shadows on hero elements is invisible cost. Hundreds of shadows in a feed-style listing produces visible jank on mid-range mobile devices.

    • Don’t apply heavy multi-layer shadows on 50+ scrolling cards. Use a single subtle shadow per card, save the multi-layer treatment for hero elements.
    • Avoid animating shadows. Animating the box-shadow property forces re-layout on every frame. Animate a wrapper’s transform: scale or translateZ instead, with a static shadow.
    • Inset shadows on text-heavy elements. Inset shadows trigger a different rendering path. Avoid stacking many on form inputs or text areas.
    • Use will-change: box-shadow sparingly. Promotes the element to its own layer, which uses memory. Reserve for elements you’ll definitely animate.

    Common box-shadow mistakes

    • Heavy single shadows. box-shadow: 0 8px 32px rgba(0,0,0,0.4) looks like a 2010 lightbox. Use multi-layer with low alpha for modern depth.
    • Coloured shadows by default. Black or near-black shadows are correct for ~95% of cases. Coloured shadows (matching the element) work for hero/marketing elements but look weird on body content.
    • Wrong blur-to-offset ratio. Blur should be roughly 2× the y-offset for natural softness. 0 4px 4px (1:1) looks tight and harsh; 0 4px 8px (1:2) looks natural; 0 4px 24px (1:6) looks dreamy/soft.
    • No spread on outset shadows. Negative spread tightens the shadow and prevents it bleeding past the element bounds — useful for cards in tight grids.
    • Forgetting dark mode. Black shadows on a dark background are invisible. Use slightly lighter shadows or rely on borders + brightness for depth in dark mode.

    Frequently asked questions

    What’s the difference between box-shadow and drop-shadow?

    box-shadow draws a shadow that follows the element’s bounding box (rectangle, even if the element has rounded corners). filter: drop-shadow() follows the element’s actual visual shape, including transparency in PNG images and SVG paths. For UI cards, box-shadow is correct. For PNG icons or SVG logos, drop-shadow is correct.

    Can I animate box-shadow smoothly?

    Browsers can transition box-shadow but it’s expensive. For smooth hover-state lifts, animate a wrapper’s transform: translateY(-2px) with a static shadow instead. The visual effect is identical but the GPU cost is much lower.

    Why does my shadow look pixelated on retina displays?

    This usually happens when blur is too small relative to retina pixel density. Increase blur to at least 4px (which becomes 8 retina pixels) for smooth edges. Sub-pixel blur is interpreted differently across browsers.

    How many shadow layers should I stack?

    Two for most cases (close + far). Three for hero/premium elements where realistic depth matters. Four+ rarely improves the visual and adds GPU cost. Material Design’s heaviest elevation uses three.

    Will the generator output Tailwind utilities?

    Yes — the tool exports both vanilla CSS and Tailwind arbitrary-value class strings. Tailwind v3 also has built-in shadow utilities (shadow-sm, shadow-md, shadow-lg, shadow-xl, shadow-2xl) that approximate Material elevations 1-5.

    Is the box-shadow data sent anywhere?

    No. The generator runs entirely in your browser — slider values, preview rendering, and the CSS output all stay on your device.

    Related tools and guides

     

  • CSS Gradient Generator Tool: Linear, Radial & Conic [2026]

    CSS Gradient Generator Tool: Linear, Radial & Conic [2026]

    TL;DR: A CSS gradient generator tool builds linear-gradient, radial-gradient, and conic-gradient backgrounds with drag-and-drop colour stops. Use linear for hero sections, radial for spotlight effects, conic for pie charts and loaders. Modern CSS supports OKLCH interpolation for smoother results without the muddy mid-points of RGB. Our free generator gives you a live preview, six presets, and copy-ready CSS plus Tailwind output.

    CSS gradients have quietly become the default web background since flat design fell out of fashion around 2018. They show up on every modern SaaS hero, the corner of every productivity-app card, behind every “premium tier” callout. Building one by hand requires remembering whether 0deg is up or right, the syntax difference between radial-gradient and conic-gradient, and the perceptual-colour quirks that make a gradient look muddy in the middle. A generator tool does all that for you with a live preview.

    Our CSS gradient generator lets you switch between linear, radial, and conic types, drag colour stops to any position, set the angle, and copy the result as either vanilla CSS or a Tailwind arbitrary-value class. This guide explains when each gradient type is appropriate, the modern OKLCH interpolation feature most generators don’t expose, the banding that ruins amateur gradients, and the framework-specific quirks worth knowing.

    The three gradient types and when each is the right choice

    CSS supports exactly three gradient functions. Each has a distinct visual signature; matching the type to the use case is the difference between a gradient that reads as intentional and one that reads as random.

    Type Visual Best uses
    linear-gradient Colour transitions in a straight line at any angle Hero backgrounds, button fills, product cards, page-level overlays
    radial-gradient Spotlight effect emanating from a point or ellipse Vignettes, “glow” effects behind content, soft circular backdrops, focus highlights
    conic-gradient Colour rotation around a centre point (think pie chart) Loading spinners, pie charts and donuts, colour wheels, holographic effects, segmented progress

    The most common mismatch: using a linear gradient where a radial would read better. A button styled with a flat top-to-bottom linear gradient looks dated (it’s the 2010 web aesthetic). The same button with a subtle radial gradient — bright centre fading darker at the edges — looks 3D and intentional. When in doubt for any contained element under ~600px wide, try radial first.

    The minimal CSS for each type:

    /* Linear: 135 degrees from bottom-left to top-right */
    background: linear-gradient(135deg, #635BFF 0%, #00D4FF 50%, #FF80B5 100%);
    
    /* Radial: a circle from the centre, fading outward */
    background: radial-gradient(circle at center, #4ADE80 0%, #22D3EE 50%, #A78BFA 100%);
    
    /* Conic: starting at 0deg from top, sweeping clockwise */
    background: conic-gradient(from 0deg at 50% 50%,
      #8B5CF6 0%, #06B6D4 33%, #F59E0B 66%, #EC4899 100%);

    The angle convention for linear-gradient is the source of more confusion than any other gradient quirk. 0deg points up, 90deg points right, 180deg points down, 270deg points left. This is opposite to mathematical convention (where 0deg points right) and opposite to SVG (where 0deg also points right). 135deg, the most popular angle in modern web design, points from bottom-left to top-right.

    Colour stops — the difference between elegant and muddy

    A gradient is fully described by a list of colour stops. The simplest gradient has two: linear-gradient(red, blue). Three or four stops give the curved colour transitions you see on premium SaaS hero sections. More than five stops usually produces visual noise rather than richness.

    • Two stops: the classic web look. Works for buttons, simple backgrounds, hover states. Choose two colours far apart on the colour wheel for maximum impact, or two close ones for subtle.
    • Three stops at 0%/50%/100%: the “premium” look. The middle colour controls the perceived hue of the transition. Most modern SaaS hero gradients use this pattern.
    • Four+ stops: aurora-style effects, retro 80s synthwave gradients, holographic backgrounds. Risk: too much colour noise unless the stops are chosen with intent.
    • Hard stops (two colours at the same position): creates a sharp edge instead of a gradient. linear-gradient(red 0%, red 50%, blue 50%, blue 100%) produces a 50/50 split. Useful for stripes, split backgrounds, percentage-bar visuals.

    The middle-stop trick: when a gradient between two colours looks muddy in the middle (for example, blue-to-yellow producing dirty green-grey), add a third stop at 50% with a colour pulled from the actual rainbow path between them. Blue → cyan → yellow looks vibrant; blue → yellow alone looks washed out. The OKLCH interpolation method (covered next) solves this automatically, but the explicit middle-stop is the universal fix.

    OKLCH interpolation — the modern fix for muddy gradients

    By default, browsers interpolate between gradient stops in the sRGB colour space — the same colour space CSS has used since 1996. sRGB is mathematically convenient but perceptually broken: equal numerical steps in sRGB don’t produce equal visual changes. The result is the muddy mid-points you see when a default linear gradient passes through a colour-wheel diagonal.

    Modern CSS (Chrome 111+, Safari 16.4+, Firefox 113+) supports specifying the interpolation colour space directly. OKLCH and Oklab are perceptually uniform — equal numerical steps look like equal visual changes. The same gradient interpolated in OKLCH versus sRGB looks dramatically different through the middle.

    /* Default sRGB interpolation (potentially muddy mid-points) */
    background: linear-gradient(135deg, #0077B6 0%, #FFD93D 100%);
    
    /* OKLCH interpolation — vibrant, no muddy middle */
    background: linear-gradient(in oklch, 135deg, #0077B6 0%, #FFD93D 100%);
    
    /* Force the longer way around the colour wheel for hue rotation */
    background: linear-gradient(in oklch longer hue, 135deg, #0077B6 0%, #FFD93D 100%);

    The longer hue modifier is the dramatic one. By default, CSS picks the shorter rotation through the colour wheel between two stops. Forcing longer hue sweeps the long way around — perfect for rainbow hero backgrounds and synthwave aesthetics. Try it once and the visual difference is striking.

    Browser support caveat: ~93% global support as of 2026. Older Safari (pre-16.4, before March 2023) and older Edge will fall back to default sRGB interpolation, which means slightly muddier gradients but no broken layout. For production safety, design your gradients to look acceptable in both modes — a hue gap of less than 90° around the wheel keeps both renderings reasonably close.

    Banding — the subtle quality killer

    Gradient banding is the visible “stripes” of colour you sometimes see across a smooth gradient — most obvious on darker, lower-saturation gradients displayed on phone screens. It happens because 8-bit colour (the standard sRGB pixel format) only has 256 levels per channel. Across a 1920-pixel-wide gradient transitioning between two close shades, that’s only ~256 distinct colours stretched over 1920 pixels — not enough to look smooth.

    • Cause #1: low-contrast gradient on a wide area. A gradient from #0a2540 to #0c2a48 across a 1920-pixel hero will band visibly. Either widen the colour range or break up the gradient with subtle noise.
    • Cause #2: 8-bit colour rendering on devices that support 10-bit. Modern Macs, iPhones, and Android flagships have 10-bit display pipelines, but CSS still produces 8-bit output unless you specify color-profile: display-p3 or use Display P3 colour functions.
    • Fix #1: add subtle noise. A 50% opacity 1×1px PNG noise texture overlaid on the gradient hides banding completely. SVG <filter feTurbulence> works too.
    • Fix #2: use Display P3 colours. color(display-p3 0.5 0.4 1) instead of #7e66ff gives the GPU more precision to work with on capable displays.
    • Fix #3: reduce the gradient’s pixel area. A 600px gradient bands less than a 1920px gradient at the same colour range, because there are more colour levels per pixel of distance.

    How to use the browser tool

    1. Open the CSS gradient generator
    2. Pick a gradient type — Linear, Radial, or Conic — at the top
    3. Adjust the angle slider (linear, conic) — direction the gradient flows
    4. Click any colour stop to edit its colour. Drag the position handle to slide the stop along the gradient
    5. Use the + button to add a stop, the trash icon to remove one (minimum two stops required)
    6. Try a preset — Accent Pop, Sunset, Ocean, Aurora, Peach, or Cosmic — for inspiration or a starting point
    7. Click Copy CSS for vanilla CSS, or Copy Tailwind for the arbitrary-value class string