Browse documentation
Reference / Backgrounds
Background images
Place a CSS image on a surface, including a pattern made from a repeating gradient.
Working example
Use underscores for spaces inside an arbitrary gradient. Use an img element with alternative text for a meaningful photograph.
<div role="img" aria-label="Diagonal ink hatching"
class="h-20 rounded bg-[repeating-linear-gradient(45deg,#111_0_4px,#eee_4px_8px)]"></div>Class reference
| Class | CSS declarations |
|---|---|
bg-none | background-image: none; |
bg-[radial-gradient(circle,#fff,#111)] | background-image: radial-gradient(circle,#fff,#111); |
bg-[repeating-linear-gradient(45deg,#111_0_4px,#eee_4px_8px)] | background-image: repeating-linear-gradient(45deg,#111 0 4px,#eee 4px 8px); |
View full generated CSS
.bg-\[radial-gradient\(circle\,\#fff\,\#111\)\] {
background-image: radial-gradient(circle,#fff,#111);
}
.bg-\[repeating-linear-gradient\(45deg\,\#111_0_4px\,\#eee_4px_8px\)\] {
background-image: repeating-linear-gradient(45deg,#111 0 4px,#eee 4px 8px);
}
.bg-none {
background-image: none;
}