To make the image background full width with React, we set the backgroundSize
CSS style to cover
.
For instance, we write
import TechnicalImage from "./images/technical.jpg";
const divStyle = {
width: "88%",
height: "800px",
backgroundImage: `url(${TechnicalImage})`,
backgroundSize: "cover",
};
<div style={divStyle}>...</div>;
to set the backgroundSize
to cover
.
Then the image background full width.