Dan
Dan

Reputation: 159

Background Position inline style with React

I've been trying to place a block of rendered jsx to the right side of the first block for the past 2 hours. I can't seem to get it right. I tried using marginTop, marginLeft , etc., but those didn't work. I looked it up, and found that I could substitute with backgroundPosition. It hasn't worked though. Here's my current line: <div style={{backgroundPosition: -400 -100}}>

Upvotes: 1

Views: 6519

Answers (1)

dwjohnston
dwjohnston

Reputation: 11781

You need to escape the values to strings.

eg:

 <div style={{backgroundPosition: '-400px -100px'}}>

The object you are passing to the style attribute should be a plain javascript object - and needs to be valid as one.

Upvotes: 5

Related Questions