CSS background-position Property

Beginner
7 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The background-position property sets the starting place of each background-image inside the area chosen by background-origin. One value, two values, or an edge offset can place the image. With several images, list positions with commas in the same order.

The initial value is 0% 0% (top left). The property is not inherited. It applies to every element, including ::first-letter and ::first-line. Pair it with background-repeat: no-repeat when you want to see one placed image instead of a tile.

Standard.

Not deprecated. Keywords, lengths, percentages, and edge offsets are Baseline. Logical keywords such as x-start, block-start, and inline-end are newer and still missing in some browsers.

CSS Syntax

syntax.css
background-position: center | top left | 25% 75% | 20px 30px | bottom 10px right 20px | initial | inherit;

One value implies center for the other axis. With two lengths or percentages, the first is horizontal and the second is vertical. Separate multiple images with commas.

Property Values

ValueDescriptionTry it
centerCenters the image in both axes. One keyword alone centers the other axisTry it
top left right bottomEdge keywords. Combine two, such as top left or bottom rightTry it
25% 75%Percentage offsets. First is horizontal, second is verticalTry it
20px 30pxLength offsets from the top-left of the positioning areaTry it
bottom 10px right 20pxEdge offsets. Each length follows the edge it offsets fromTry it
0 0, centerOne position per image in a comma-separated listTry it
initialResets this property to 0% 0%Try it
inheritCopies this property from the parent elementTry it

How to Use background-position

Give the element an image, stop the tile if you need a clear mark, then set the position.

  1. Set a background-image on the element. Without an image, there is nothing to place.
  2. Give the element a visible size. Content or a height is enough.
  3. Use background-repeat: no-repeat when you want one image, not a full tile.
  4. Set background-position with a keyword, a pair of values, or an edge offset. It is not inherited.
PieceRequired?Role
background-imageYesThe picture or gradient you are placing
A visible boxYesContent or a height, so the position has somewhere to show
background-positionYesKeywords, percentages, lengths, or edge offsets
background-repeatOftenno-repeat keeps a single placed image easy to see
background-originNoWhich box the position is measured against

Live Preview

One blue marker. Change background-position and watch where it sits in the box.

The marker does not repeat. Only its starting place changes.

Position

background-position: center

CSS Examples

Each snippet adds only what background-position needs: an image, a sized box, and no-repeat so the mark is clear. Use Try It Yourself for a live editor.

Example 1 — Center the Image

Place a single marker in the middle of the box.

CSS
<style>
  div {
    height: 160px;
    border: 1px solid #ccc;
    background-color: #eff6ff;
    background-image: radial-gradient(circle, #2563eb 0 28px, transparent 29px);
    background-repeat: no-repeat;
    background-size: 72px 72px;
    background-position: center;
  }
</style>

<div></div>
Try It Yourself

How It Works

  1. Make a box. height: 160px and the border give the image a clear area to sit in.
  2. Paint a marker. The radial gradient is a blue circle used as the background image. background-size keeps that circle small.
  3. Stop the tile. background-repeat: no-repeat shows one circle. Without it, copies would fill the box and hide the placement.
  4. Center it. background-position: center puts the circle in the middle on both axes.

Example 2 — Percentage Place

Line up a point on the image with the same point on the box.

CSS
<style>
  div {
    height: 160px;
    border: 1px solid #ccc;
    background-color: #ecfdf5;
    background-image: radial-gradient(circle, #059669 0 28px, transparent 29px);
    background-repeat: no-repeat;
    background-size: 72px 72px;
    background-position: 25% 75%;
  }
</style>

<div></div>
Try It Yourself

How It Works

  1. Read left to right, then top to bottom. 25% is the horizontal place. 75% is the vertical place.
  2. Match points, not edges only. The point 25% across the image meets the point 25% across the box. The same idea applies for 75% on the vertical axis.
  3. 0% and 100% are the edges. 0% 0% is top left. 100% 100% is bottom right. 50% 50% is center.
  4. Size still matters. If the image were the same size as the box, a percentage would have no leftover space to slide. Here the circle is smaller, so the move is visible.

Example 3 — Edge Offsets

Anchor to an edge, then nudge inward with a length.

CSS
<style>
  div {
    height: 160px;
    border: 1px solid #ccc;
    background-color: #fff7ed;
    background-image: radial-gradient(circle, #ea580c 0 28px, transparent 29px);
    background-repeat: no-repeat;
    background-size: 72px 72px;
    background-position: bottom 10px right 20px;
  }
</style>

<div></div>
Try It Yourself

How It Works

  1. Name the edge first. bottom and right choose which edges the image sits against.
  2. Offset after each edge. 10px follows bottom, so the circle lifts 10px from the bottom. 20px follows right, so it moves 20px inward from the right.
  3. Order of the pairs can swap. right 20px bottom 10px is the same placement. A bare length before the keyword, such as 20px right, is invalid.
  4. Use this for padding from a corner. Plain bottom right sticks to the corner. The lengths leave a small gap from those edges.

Edge Cases & Pitfalls

If the image looks stuck, tiled, or unchanged, one of these is usually why.

repeat

Tiles hide a clear placement

The initial background-repeat is repeat. The starting place still applies, but copies fill the box. Use no-repeat when you want one image.

size

A full-size image ignores percentages

If background-size matches the box on an axis, that axis has no leftover space. A percentage then looks stuck. Use a length, or make the image smaller than the box.

order

20px right is invalid

A length or percentage that pairs with a keyword must follow that keyword: right 20px. Two keywords can swap (top left equals left top). Two lengths stay horizontal first, then vertical.

origin

Position is measured from background-origin

background-origin picks border-box, padding-box, or content-box. Changing the origin moves the same position value relative to a different box.

shorthand

The background shorthand resets position

A later background: #fff sets every background longhand, including background-position: 0% 0%. Set position after the shorthand, or include it in the shorthand.

Browser Support

background-position is a browser painting property. Node.js, Deno, and Bun do not apply it. Keywords, lengths, and percentages are older than edge offsets. Logical keywords such as x-start are newer.

✓ Baseline · Widely available since 2015

background-position

Keywords, lengths, percentages: every current browser and IE 4+. Multiple positions: IE 9+. Three- and four-value edge offsets: Chrome 25+, Firefox 13+, Safari 7+, IE 9+, Edge 12+.

99% Keywords and offsets
Google Chrome 1+ · 25+ edge offsets
Full support
Mozilla Firefox 1+ · 13+ edge offsets
Full support
Apple Safari 1+ · 7+ edge offsets
Full support
Microsoft Edge 12+
Full support
Opera 3.5+ · 15+ edge offsets
Full support
Samsung Internet 1+
Full support
Internet Explorer 4+ · 9+ multi & offsets
Partial
background-position Widely supported

Bottom line: Safe for keywords, lengths, percentages, and edge offsets in current browsers. Multiple background positions need Internet Explorer 9 or newer. Logical keywords such as x-start and block-start are still limited — prefer physical keywords on a normal page.

Key Takeaways

  • Role: place each background image inside the area from background-origin.
  • Values: keywords, percentages, lengths, or edge offsets such as bottom 10px right 20px.
  • Initial value: 0% 0% (top left). It is not inherited.
  • See it clearly: use background-repeat: no-repeat when a single placed image is the goal.

One line: background-position chooses where the image starts — after you have an image, and usually after you turn off tiling.

Frequently Asked Questions

It sets where each background image starts inside the background positioning area. Keywords, percentages, lengths, and edge offsets all place that image. The initial value is 0% 0%, which is the top-left corner.
0% 0%, the same as left top. The image starts at the top-left of the area defined by background-origin. The property is not inherited.
A percentage lines up that point on the image with the same point on the box. 0% is the start edge of both. 50% centers. 100% lines up the end edges. If the image is the same size as the box, a percentage offset has no room to move.
background-origin chooses the box the image is measured against: border-box, padding-box, or content-box. background-position places the image inside that area.
background-repeat defaults to repeat. The position still applies, but copies fill the rest of the box. Set background-repeat: no-repeat when you want to see a single placed image.
Keywords, lengths, and percentages work in every current browser and in Internet Explorer 4 and newer. Multiple positions need Internet Explorer 9 or newer. Three- and four-value edge offsets need Chrome 25, Firefox 13, Safari 7, or Internet Explorer 9. This is a browser CSS property. Node.js, Deno, and Bun do not paint it.

Next: background-position-x

Learn how to set only the horizontal place of a background image.

background-position-x tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful