react button background image code example
Example 1: 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'
}}
Example 2: how to import background image in inline css in react
style={{backgroundImage: `url(${pencil})`}}
Example 3: background image in react from variable
var divStyle = {
backgroundImage: 'url(' + imgUrl + ')',
width: '300px'
};