Answers for "how to change background image in react"

16

react background image

style={{  
  backgroundImage: "url(" + "https://images.pexels.com/photos/34153/pexels-photo.jpg?auto=compress&cs=tinysrgb&h=350" + ")",
  backgroundPosition: 'center',
  backgroundSize: 'cover',
  backgroundRepeat: 'no-repeat'
}}
Posted by: Guest on April-12-2020
1

how to import background image in inline css in react

style={{backgroundImage: `url(${pencil})`}}
Posted by: Guest on April-30-2020
0

how to change background image dynamically in react

render: function() {
  var divImage = {
    backgroundImage : "url(" + this.state.song.imgSrc + "),url(" + this.state.nextImgSrc + ");" 
  };

  return (
    <li>
      <div ref="image-pane" className="player" style={divImage}></div>
    </li>
  )
}
Posted by: Guest on February-05-2021

Code answers related to "how to change background image in react"

Code answers related to "Javascript"

Browse Popular Code Answers by Language