Hard Shadow
硬边投影
A solid, unblurred shape is offset from the element to define a crisp shadow.
Where to use it
Give buttons, posters or interface labels a bold graphic appearance. Leave enough clearance around a strong offset shadow so nearby targets remain distinct.
Practical example
An independent print shop gives its checkout button a solid purple shadow offset down and right. The crisp block makes the button easy to pick out below the print specifications.
AI prompt
Add a Hard Shadow to [target element]. Use a small horizontal and vertical box-shadow offset with zero blur and a contrasting opaque color. Check spacing where it overlaps nearby elements and preserve a visible keyboard focus ring.
Example code
Save the standalone HTML as a file and open it in your browser. It uses the same code as the preview.
View HTML
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Hard Shadow</title>
<style>
:root {
color-scheme: dark;
--demo-bg: #171629;
--demo-ink: #f8f5ff;
--demo-accent: #b9a6ff;
--demo-muted: #bfbbd3;
font-family: system-ui, sans-serif;
color: var(--demo-ink);
background: var(--demo-bg);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 0; }
button, input { font: inherit; }
.demo {
display: grid;
place-items: center;
align-content: center;
min-height: 100vh;
padding: 14px;
overflow: hidden;
background: radial-gradient(ellipse at 50% 24%, #28233f, var(--demo-bg) 78%);
}
.demo-button {
border: 1px solid #ffffff3d;
border-radius: 7px;
background: #ffffff12;
color: var(--demo-ink);
padding: 6px 11px;
font-size: 12px;
cursor: pointer;
}
:focus-visible {
outline: 2px solid var(--demo-accent);
outline-offset: 3px;
}
.visual-specimen {
width: min(100%, 290px);
height: 124px;
display: grid;
place-items: center;
position: relative;
isolation: isolate;
}
.hard-card {
padding: 16px 24px; border: 2px solid #34203a; border-radius: 6px; color: #38203d;
font-size: 18px; background: #ffd4ad; box-shadow: 8px 8px 0 #c479a7;
}
</style>
</head>
<body>
<main class="demo">
<div class="visual-specimen" aria-hidden="true"><b class="hard-card">Accent</b></div>
</main>
</body>
</html>Original example by UI Skills