Skip to Content

Border and Shadow

Borders and shadows are among the most common visual tools in modern UI. Borders help define edges, separation, and states, while shadows add depth and emphasis around an element’s frame [web:153][web:144].

Border

AliasCSS includes utilities for border reset, radius, width, side-specific borders, border style, and border color. This maps closely to native CSS, where the border shorthand combines width, style, and color into one declaration [web:153].

Examples

ClassnameShorthandCompiled style
border-nonebnborder:none
border-radius-12pxbr-12pxborder-radius:12px
border-width-1pxbw-1pxborder-width:1px
border-width-1px-2pxbw-1px-2pxborder-width:1px 2px
border-1px-solid-redb-1px-s-redborder:1px solid red
border-1px-dashed--border-colorb-1px-d--border-colorborder:1px dashed var(--border-color)
border-right-1px-solid-redbrt-1px-s-redborder-right:1px solid red
border-top-1px-solid-redbt-1px-s-redborder-top:1px solid red
border-left-1px-solid-redbl-1px-s-redborder-left:1px solid red
border-bottom-1px-solid-redbb-1px-s-redborder-bottom:1px solid red
border-color-redbc-redborder-color:red
border-bottom-color-redbbc-redborder-bottom-color:red
border-style-solidbss orborder-style:solid
border-style-dashedbsd or bsd/dashedborder-style:dashed
border-style-dottedbsdt or bsd3 or bsd/dottedborder-style:dotted
border-style-doublebsdb or bsd2 or bsd/doubleborder-style:double
border-style-groovebsgborder-style:groove
border-style-insetbsiborder-style:inset
border-style-nonebsnborder-style:none

Usage

<h1 class="p-32px br-8px b-1px-s-e3e3e3 d-f w-100px mh-64px" > Hello, World </h1>

border-radius rounds the corners of an element’s outer border edge, so it is especially useful for cards, buttons, inputs, badges, and modern surface components [web:151].

🧱

In modern UI, borders usually work best when they are subtle. For many surfaces, a light border plus a soft shadow feels cleaner than a heavy border alone.

Box shadow

AliasCSS also supports direct box-shadow utilities, including inset shadows, multi-layer shadows, and color functions. MDN defines box-shadow as a property that adds shadow effects around an element’s frame, and multiple shadows can be separated with commas [web:144].

Examples

ClassnameShorthandCompiled style
box-shadow-1px-1px-1px-redbxs-1px-1px-1px-redbox-shadow:1px 1px 1px red
box-shadow-inset-5em-1em-blue200bxs-i-5em-1em-blue200box-shadow:inset 5em 1em var(--blue200,#B2DDFF)
box-shadow-2px-2px-2px-1px-rgb-231-0-0-0.4bxs-2px-2px-2px-1px-rgb-231-0-0-0.4box-shadow:2px 2px 2px 1px rgb(231 0 0 / 0.4)
box-shadow-2px-2px-2px-1px-red__1px-1px-4px-skyBluebxs-2px-2px-2px-1px-red__1px-1px-4px-skyBluebox-shadow:2px 2px 2px 1px red, 1px 1px 4px skyBlue

Usage

<h1 class="p-32px br-8px bxs-1px--1px-2px-2px--black/7 d-f w-100px mh-64px" > Hello, World </h1>

The box-shadow property supports horizontal offset, vertical offset, blur radius, spread radius, optional inset, and one or more shadow colors, which makes it flexible enough for soft elevation, focus rings, inner shadows, and multi-layer depth [web:144][web:152].

Borders and shadows together

Borders and shadows often work best together. If an element has a border-radius, the shadow follows the same rounded corners, which helps card and button surfaces feel coherent [web:149].

A practical pattern for modern UI is:

  • Use a thin border for edge definition.
  • Use a soft shadow for elevation.
  • Use radius to match the visual softness of the component.
  • Keep shadow color low-contrast unless the design intentionally calls for dramatic depth.

CSS variables for complex values

When border or shadow values become complex, CSS variables are usually the cleanest solution.

💡

You can always use CSS variables to handle complex shadow values, then reference them in AliasCSS classes.

<button class="display-inline-flex b-1px-s-primary600 bxs--shadow-sm" style=' --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1) ' > Hello, World </button>

This approach is especially useful for reusable elevation tokens such as --shadow-sm, --shadow-md, and --shadow-lg, or when your design system wants centralized control over shadow recipes.

Guidance

A practical way to use border and shadow utilities in AliasCSS is:

  • Use borders for separation and state.
  • Use radius to soften shape.
  • Use shadows for depth, not decoration overload.
  • Prefer tokenized shadow variables for consistency.
  • Combine border, radius, and shadow intentionally so surfaces feel part of one visual system.

That makes these utilities work well not only for simple components, but also for cards, panels, dialogs, tables, and full design-system surface patterns.

Last updated on