admin管理员组文章数量:1405501
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}}>
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}}>
1 Answer
Reset to default 5You 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.
本文标签: javascriptBackground Position inline style with ReactStack Overflow
版权声明:本文标题:javascript - Background Position inline style with React - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744921644a2632329.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论