# Inset Border Shadow

> Borders drawn with inset box-shadow, so hover and selected states never shift the layout.

- Category: [CSS Box Shadows](https://copy-css.com/category/shadows)
- Tags: border, no layout shift, selected, ring, inset
- Live preview: https://copy-css.com/snippets/inset-border-shadow
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

```html
<div class="inset-border">Basic</div>
<div class="inset-border is-selected">Pro</div>
<div class="inset-border">Team</div>
```

## CSS

```css
.inset-border {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 14px;
  background: #f8fafc;
  color: #334155;
  font: 600 14px system-ui, sans-serif;
  box-shadow: inset 0 0 0 1px #e2e8f0;
  transition: box-shadow 0.2s ease;
}

.inset-border:hover {
  box-shadow: inset 0 0 0 2px #94a3b8;
}

/* Thicker ring, same box size: nothing around it moves */
.inset-border.is-selected {
  background: #eef2ff;
  color: #3730a3;
  box-shadow: inset 0 0 0 3px #6366f1;
}
```

## Notes

- This CSS Inset Border Shadow is 23 lines of pure CSS (0.5 KB) with no JavaScript and no dependencies. It uses transitions, box shadows and CSS Grid.
- In JSX use `className` instead of `class`. In Tailwind projects put the CSS in the global stylesheet.
