Browse documentation
Reference / Backgrounds
Background position
Anchor a background image to an edge or a point inside its positioning area.
Working example
Give the image a size smaller than the available area to see the alignment. A fully covering image can hide the effect.
<div role="img" aria-label="A circle anchored in the top right"
class="h-20 border bg-[radial-gradient(circle,#171717_56%,transparent_58%)] bg-[size:3rem_3rem] bg-no-repeat bg-right-top"></div>Class reference
| Class | CSS declarations |
|---|---|
bg-center | background-position: center; |
bg-top | background-position: top; |
bg-left-bottom | background-position: left bottom; |
bg-right-top | background-position: right top; |
bg-[position:75%_50%] | background-position: 75% 50%; |
View full generated CSS
.bg-\[position\:75\%_50\%\] {
background-position: 75% 50%;
}
.bg-center {
background-position: center;
}
.bg-left-bottom {
background-position: left bottom;
}
.bg-right-top {
background-position: right top;
}
.bg-top {
background-position: top;
}