How do I get my background image to start halfway from the right?

I have a background image that I want contained (background-size: contain) in a div, and I want the left side of the image to start 50% from the left. I would have thought this would be an easy task, but Google is failing me. Can I get a hand? Thanks!
SiobhanElaraAsked:
Who is Participating?
 
Eddie ShipmanAll-around developerCommented:
Try:
background-position:calc(50% - (1024px * 0.50)) 0; /*change 1024px to width of your image*/

Open in new window

1
 
Eddie ShipmanAll-around developerCommented:
Either give us a URL or show your HTML/CSS, please.
0
 
SiobhanElaraAuthor Commented:
I'm working with Bootstrap:

<div class="background">
	<div class="container">
		<div class="row">
			<div class="col-md-6 mb-5">
				<p>here's the text</p>
			</div>
		</div>
	</div>
</div>

Open in new window


I'm wanting the background image of .background to start halfway across the page so it doesn't overlap the text and will bleed off the right side of the page if need be. The css I currently have (which is obviously just centering it) is

	.background{ 
		background-image: url(../images/background.jpg); 
		background-repeat: no-repeat;
		background-size: contain; 
		background-position-x: 50%;
		background-position-y: bottom; 
	}

Open in new window

0
 
SiobhanElaraAuthor Commented:
I changed the - to a + and it worked perfectly! Thank you. :)
0
 
Eddie ShipmanAll-around developerCommented:
Selected endorsed solution
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.