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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SiobhanElaraAuthor Commented:
I changed the - to a + and it worked perfectly! Thank you. :)
0
Eddie ShipmanAll-around developerCommented:
Selected endorsed solution
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
CSS

From novice to tech pro — start learning today.