I want to set the background image of a container div from an image from a local folder. Does anyone know what i need to add to my code/ how to edit it to do this? Currently the image isnt showing for some reason.
class Team extends React.Component{
render(){
let style = {
backgroundRepeat: 'no-repeat',
backgroundImage:'url("../images/Football_Field.png")',
backgroundSize: '100% 100%',
backgroundPosition: 'center',
width: '100%',
height: '100%',
border: '2px dashed #333'
}
return (
<div className="container" style={style}>
<i className="fas fa-tshirt"></i>
</div>
)
}
}
export default Team
The image is in a 'image' folder inside the src folder. (/src/images/Football_Field.png)
The Team
components file path is '/src/components/Team'.
Would anyone also know how to do this if i instead used a ui container class?