As a novice, I am faced with the challenge of making a full image background in my react portfolio project. Despite my efforts, I have been unable to achieve the desired outcome.
How can I implement a full image background in React for my portfolio showcase?
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body,
html {
margin: 0;
font-family: "Poppins", sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
height: 100%;
}
The styling details are defined in my index.css file:
I have set up a component specifically for the background image:
const background = {
backgroundImage: `url(${Background})`,
height: "100%",
backgroundPosition: "center",
backgroundRepeat: "no-repeat",
backgroundSize: "cover",
};
Next, I call this component within my React component:
return (
<div style={background}>
<h1> Hello </h1>
</div>
)
Despite my attempts and research, I am still encountering issues as seen in the following image: https://i.sstatic.net/MP4iC.png
I have explored various methods but have not yet found a successful solution :(