From 94b0178d1ab72b178eedee5d40ae9a567a1412eb Mon Sep 17 00:00:00 2001
From: CaptainTech205 <9319730+CaptainTech205@users.noreply.github.com>
Date: Fri, 6 Feb 2026 18:20:35 +0100
Subject: [PATCH 1/2] First version of this markdown
---
.../background-position-x.md | 62 +++++++++++++++++++
1 file changed, 62 insertions(+)
create mode 100644 content/css/concepts/background/terms/background-position-x/background-position-x.md
diff --git a/content/css/concepts/background/terms/background-position-x/background-position-x.md b/content/css/concepts/background/terms/background-position-x/background-position-x.md
new file mode 100644
index 00000000000..6569ad2f91c
--- /dev/null
+++ b/content/css/concepts/background/terms/background-position-x/background-position-x.md
@@ -0,0 +1,62 @@
+---
+Title: CSS background-position-x
+Description: Sets the inital horizontal position of a background image.
+Subjects:
+ - CSS
+ - Web design
+ - Web Development
+Tags:
+ - Layout
+ - Background
+ - HTML
+CatalogContent:
+ - Learn CSS
+ - UX Designer
+ - Learn Intermediate CSS
+ - Front-End Engineer
+ - Full-Stack Engineer
+---
+The CSS **background-position-x** property sets the initial horizontal position (the x axis) of a background image. This position is defined relative to the coordinate system established by the [background-origin](https://www.codecademy.com/resources/docs/css/background/background-origin) property.
+
+Note that the value of background-position-x is overridden by any subsequent declarations of the background or [background-position](https://www.codecademy.com/resources/docs/css/background/background-position) shorthand properties. By default, a background image is placed at the top-left corner of an element and repeated both vertically and horizontally.
+
+## Syntax
+```css
+/* Keyword values */
+background-position-x: left;
+background-position-x: right;
+background-position-x: center;
+
+/* Length and percentage values */
+background-position-x: 64px;
+background-position-x: 25%;
+background-position-x: 5em;
+background-position-x: 1cm;
+
+/* Global values */
+background-position-x: inherit;
+background-position-x: initial;
+background-position-x: revert;
+background-position-x: revert-layer;
+background-position-x: unset;
+```
+
+## Example
+In the following example we use the HTML div tag to set the background image with CSS.
+
+### HTML
+```html
+
+
+```
+
+### CSS
+```css
+div {
+ width: 500px;
+ height: 500px;
+ background-image: url("https://i.pcmag.com/imagery/reviews/05XBKmNFYeHCMIn726Nohqb-10..v1627594235.png");
+ background-repeat: no-repeat;
+ background-position-x: center;
+}
+```
\ No newline at end of file
From 4f725bf21805f140435b8193857a18f47ff64ea2 Mon Sep 17 00:00:00 2001
From: CaptainTech205 <9319730+CaptainTech205@users.noreply.github.com>
Date: Sat, 14 Feb 2026 13:44:36 +0100
Subject: [PATCH 2/2] Fixed requested changes in PR #8224
---
.../background-position-x.md | 60 ++++++++----------
media/css_background_position_x_example.png | Bin 0 -> 3597 bytes
2 files changed, 26 insertions(+), 34 deletions(-)
create mode 100644 media/css_background_position_x_example.png
diff --git a/content/css/concepts/background/terms/background-position-x/background-position-x.md b/content/css/concepts/background/terms/background-position-x/background-position-x.md
index 6569ad2f91c..4bb2a25cf72 100644
--- a/content/css/concepts/background/terms/background-position-x/background-position-x.md
+++ b/content/css/concepts/background/terms/background-position-x/background-position-x.md
@@ -1,46 +1,34 @@
---
Title: CSS background-position-x
Description: Sets the inital horizontal position of a background image.
-Subjects:
- - CSS
- - Web design
- - Web Development
+Subjects:
+ - 'Web Design'
+ - 'Web Development'
Tags:
- - Layout
- - Background
- - HTML
+ - 'CSS'
+ - 'Background'
+ - 'Positioning'
+ - 'Properties'
+ - 'Layout'
CatalogContent:
- - Learn CSS
- - UX Designer
- - Learn Intermediate CSS
- - Front-End Engineer
- - Full-Stack Engineer
+ - 'learn-css'
+ - 'paths/front-end-engineer-career-path'
---
The CSS **background-position-x** property sets the initial horizontal position (the x axis) of a background image. This position is defined relative to the coordinate system established by the [background-origin](https://www.codecademy.com/resources/docs/css/background/background-origin) property.
Note that the value of background-position-x is overridden by any subsequent declarations of the background or [background-position](https://www.codecademy.com/resources/docs/css/background/background-position) shorthand properties. By default, a background image is placed at the top-left corner of an element and repeated both vertically and horizontally.
## Syntax
-```css
-/* Keyword values */
-background-position-x: left;
-background-position-x: right;
-background-position-x: center;
-
-/* Length and percentage values */
-background-position-x: 64px;
-background-position-x: 25%;
-background-position-x: 5em;
-background-position-x: 1cm;
-
-/* Global values */
-background-position-x: inherit;
-background-position-x: initial;
-background-position-x: revert;
-background-position-x: revert-layer;
-background-position-x: unset;
+```pseudo
+background-position-x: value;
```
+### Parameters
+Value can be one of the following:
+- Position keyword: `left`, `right`, `center`
+- Length and percentage values: `64px`, `5em`, `1cm`, `25%`
+- Global values: `inherit`, `initial`, `revert`, `revert-layer`, `unset`
+
## Example
In the following example we use the HTML div tag to set the background image with CSS.
@@ -53,10 +41,14 @@ In the following example we use the HTML div tag to set the background image wit
### CSS
```css
div {
- width: 500px;
- height: 500px;
- background-image: url("https://i.pcmag.com/imagery/reviews/05XBKmNFYeHCMIn726Nohqb-10..v1627594235.png");
+ width: 300px;
+ height: 300px;
+ background-color: grey;
+ background-image: url("../../../../../../media/cc_logo.png");
background-repeat: no-repeat;
background-position-x: center;
}
-```
\ No newline at end of file
+```
+
+### Result
+
\ No newline at end of file
diff --git a/media/css_background_position_x_example.png b/media/css_background_position_x_example.png
new file mode 100644
index 0000000000000000000000000000000000000000..7f14eb01bb1d9eb81d8c99b385db36f3048cc304
GIT binary patch
literal 3597
zcmd^CX;f2577ik6gDkQNve*sE+R#cPF-X|N7*O^QOb948gb-0MEV4v!0|E`G1Q|d<
zK(<7JX^a7avWudipdo++2#jndDlH)hB$>y|kDl&xdd~cqUp?o%I#qS6>fZ0XTlYI(
zk-R)$it;-0AP`6qe)O;p2qa?%G|09sfCZN-3;{YBf)C6YMC;d`2PT`bPRE@DNp+%^e^cuOAiDEd0x95yffP6k_~DN7E^3{aU;+52pt
zaIb9PmAf~>>(1xBxf7jWF_yqDVTxsY$rIdf)WIJ|Uai?QNRwNcq8@t7>KJfEqS3o@ns>)NzW;i_6b@N$FNwNFxb9ZD
z6exBhiWWbqwJ2EB(x-7}tkxbj_y+3=a07;iNSN%!%Yn+%m%
z`uR_OwujlrP{CKFY;AkzwdE%|wB`$v9)|%#Pm4E|Gse%A=1Pa!ZR66WEp_5-7iLKD
z=Dph$klxF;9K
zUg$=#XhC=m8xIT2iim#uMn@BEvx8cQS@81?>3F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