I have an image and i need to make it cover all of the background.
The problem is, that for some reason the image isn’t covering all of the background, and it always stops somwhere where i put another object, and never goes farther then this.
Im using material ui and my code looks like this
JavaScript
x
30
30
1
import { Image } from "../images";
2
import { TextField } from "@mui/material";
3
4
const useStyles = makeStyles({
5
Background: {
6
display: "flex",
7
alignItems: "center",
8
justifyContent: "center",
9
justifyItems: "center",
10
flexDirection: "row-reverse",
11
width: "100%",
12
height: "100%",
13
backgroundImage: `url(${Image})`,
14
backgroundSize: "cover",
15
backgroundRepeat: 'no-repeat',
16
backgroundPosition: '50% 10%',
17
}
18
})
19
20
function Login() {
21
const classes = useStyles();
22
23
return (
24
<div className={classes.Background}>
25
<TextField></TextField>
26
</div>
27
);
28
}
29
30
Advertisement
Answer
Try this style
JavaScript
1
17
17
1
Background: {
2
display: "flex",
3
alignItems: "center",
4
justifyContent: "center",
5
justifyItems: "center",
6
flexDirection: "row-reverse",
7
width: "100%",
8
height: "100vh",
9
backgroundImage: `url(${asd})`,
10
backgroundSize: "cover",
11
backgroundRepeat: "no-repeat",
12
backgroundPosition: "50% 10%"
13
}
14
15
16
17