CSS background-position-y Property

Beginner
⏱️ 5 min read
📚 Updated: Jun 2026
🎯 4 Examples
Backgrounds & Layout

What You’ll Learn

The background-position-y property controls the vertical placement of a background image. It lets you move a background up or down without changing its horizontal position.

01

Vertical Axis

Move backgrounds up and down.

02

Keywords

top, center, bottom.

03

Percentages

Relative y placement.

04

Pixels

Exact top offsets.

05

With position-x

Split axis control.

06

Shorthand

Related to background-position.

Definition and Usage

The background-position-y CSS property sets the vertical starting position of a background image. It affects placement along the y-axis only, leaving the horizontal position to background-position-x or the shorthand background-position.

This is useful when you want to align a decorative icon, badge, or photo to the top, center, or bottom while keeping horizontal placement unchanged.

💡
Beginner Tip

Use a small non-repeating background with a fixed background-size so vertical movement is easy to see.

📝 Syntax

Apply background-position-y to control vertical background placement:

syntax.css
selector {
  background-position-y: <position>;
}

Basic Example

background-position-y.css
.panel {
  background-image: url("icon.svg");
  background-repeat: no-repeat;
  background-position-x: center;
  background-position-y: bottom;
}

Syntax Rules

  • The initial value is 0%, which aligns the background to the top (same as top).
  • Accepted values include top, center, bottom, percentages, and lengths.
  • It changes only the vertical axis.
  • Use background-position-x for horizontal control.
  • background-position: center bottom; is shorthand for both axes together.

⚡ Quick Reference

QuestionAnswer
Initial value0% (top)
Applies toVertical background placement
InheritedNo
AnimatableYes
Common useTop/bottom icons, centered hero focal points, vertical offsets

Default Value

The initial value of background-position-y is 0%, which places the background at the top edge of the background positioning area. The keyword top produces the same result.

💎 Property Values

These are the most common ways to set vertical background placement with background-position-y.

ValueExampleMeaning
topbackground-position-y: top;Aligns the background to the top edge
centerbackground-position-y: center;Centers the background vertically
bottombackground-position-y: bottom;Aligns the background to the bottom edge
Percentagebackground-position-y: 50%;Positions relative to element height
Lengthbackground-position-y: 24px;Offsets the background by an exact distance from the top
top

Places the background at the top edge of the positioning area.

Default-like alignment.

center

Centers the background vertically inside the element.

Common for hero images.

bottom

Aligns the background to the bottom edge.

Useful for footer badges.

75%

Moves the background toward the bottom using a percentage.

Responsive vertical placement.

background-position-y vs background-position

PropertyControlsBest for
background-position-yVertical background placement onlyTop/center/bottom alignment without changing x-axis
background-positionBoth horizontal and vertical placementOne-line positioning such as center bottom
background-position-xHorizontal background placement onlyLeft/center/right alignment without changing y-axis

👀 Live Preview

These panels keep the same horizontal position and change only the vertical value:

top
center
bottom

background-position-x: center; stays the same in all three panels.

Examples Gallery

Try background-position-y with bottom placement, top/bottom keywords, pixel offsets, and a multi-value comparison.

📚 Vertical Placement

Control where a background sits along the y-axis while horizontal placement stays separate.

Example 1 — Position at the Bottom

Place a background at the bottom of an element while keeping it centered horizontally.

bottom-y-position.css
.panel {
  background-image: url("icon.svg");
  background-repeat: no-repeat;
  background-position-x: center;
  background-position-y: bottom;
}
Try It Yourself

How It Works

background-position-y: bottom; anchors the background to the bottom edge, while background-position-x: center; keeps it horizontally centered.

Example 2 — top vs bottom

Compare the two most common vertical keyword positions.

top-bottom-y.css
.top { background-position-y: top; }
.bottom { background-position-y: bottom; }
Try It Yourself

How It Works

The same background marker moves to opposite vertical edges using keyword values.

🎨 Exact Vertical Offsets

Use pixel and percentage values when keywords are not precise enough.

Example 3 — Pixel Offset from the Top

Move a background a fixed distance from the top edge.

pixel-y-position.css
.panel {
  background-position-y: 24px;
  background-position-x: center;
}
Try It Yourself

How It Works

A length value offsets the background vertically by an exact amount from the top edge. Positive values move it down; negative values move it up.

Example 4 — Compare Vertical Values

See how different background-position-y values move the same marker up and down.

y-position-compare.css
.top { background-position-y: top; }
.center { background-position-y: center; }
.percent { background-position-y: 75%; }
Try It Yourself

How It Works

Only the vertical value changes, so the marker moves up and down while staying horizontally centered.

🧠 How background-position-y Works

1

You add a background image

Set an image or gradient with background-image.

Background
2

You set the y-axis position

Use background-position-y with top, center, bottom, percentages, or pixels.

Vertical rule
3

Horizontal placement stays separate

Control the x-axis with background-position-x or the shorthand background-position.

Split axes
=

Precise vertical control

You can align backgrounds to the top, center, or bottom without affecting horizontal placement.

Universal Browser Support

background-position-y is supported in all modern browsers and works reliably for vertical background placement.

Baseline · Modern browsers

Control vertical background placement today

Chrome, Firefox, Safari, Edge, and Opera support keyword, percentage, and length values.

98% Modern browser support
Google Chrome1+ · Desktop & Mobile
Full support
Mozilla Firefox49+ · Desktop & Mobile
Full support
Apple Safari15+ · macOS & iOS
Full support
Microsoft Edge12+ · Modern versions
Full support
Opera36+ · Modern versions
Full support

Fallback behavior

In older browsers, use the shorthand background-position as a fallback when split-axis properties are unavailable.

💻
Legacy browsers May require background-position instead of split x/y properties
Fallback
background-position-y property 98% supported

Bottom line: Use background-position-y confidently in modern projects, especially with background-position-x for split-axis control.

Conclusion

The background-position-y property gives you direct control over vertical background placement. It is especially useful when you want to align an image to the top, center, or bottom without changing its horizontal position.

Pair it with background-position-x for full two-axis control, or use background-position when a single shorthand declaration is enough.

💡 Best Practices

✅ Do

  • Use top, center, and bottom for simple vertical alignment
  • Pair with background-position-x when axes need separate control
  • Use percentages for responsive vertical placement
  • Keep non-repeating backgrounds small when teaching placement
  • Provide a background-position fallback for older browsers if needed

❌ Don’t

  • Confuse background-position-y with the full shorthand property
  • Expect visible movement when the background fully covers the element
  • Forget that the default vertical position is top (0%)
  • Change x and y in separate places when shorthand would be simpler
  • Ignore focal points on responsive hero images

Key Takeaways

Knowledge Unlocked

Five things to remember about background-position-y

Use these points when placing backgrounds vertically.

5
Core concepts
📝02

Keywords

top, center, bottom.

Values
📊03

Percentages

Responsive y placement.

Responsive
04

0% Default

Top edge by default.

Default
🛠05

With position-x

Split axis control.

Compare

❓ Frequently Asked Questions

The background-position-y property sets the vertical position of a background image. It controls placement along the y-axis without changing the horizontal position.
The initial value is 0%, which places the background at the top edge of the background positioning area. This is equivalent to the top keyword.
Yes. The common keywords are top, center, and bottom.
background-position-y controls only the vertical axis. background-position can set both horizontal and vertical placement in one declaration.
Yes. You can use both properties together to control vertical and horizontal placement separately.

Practice in the Live Editor

Open the HTML editor, move backgrounds vertically, and experiment with background-position-y instantly.

HTML Editor →

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.

5 people found this page helpful