I am having a problem with covering the background in CSS.
Before:
.main-bg {
background: no-repeat url("../../images/main_bg.jpeg");
height: 100vh;
color: white;
}
After:
.main-bg {
background: no-repeat url("../../images/main_bg.jpeg") cover;
height: 100vh;
color: white;
}
Anyone know how to fix this? Thanks!
Advertisement
Answer
You cannot have cover alone in the background property. You are obliged to define the position as well:
background: no-repeat url("../../images/main_bg.jpeg") center/cover;
Or add background-size: cover