Responsive full background Image

Asked

Viewed 89 times

1

I’m having some issues with my background image. I have a full background image in my website, and I want a Responsive website, but when I Try to see it on my phone, the image height is not correct.

what resolutions should I have in the background image to fit all Devices? I want to have a background image that occupies the entire screen, Even at diferent Heights.

(I already have media queries, but i don’t know the resolutions I need)

(I think I have Too Many resolutions and i don’t need all)

body {
background-image: url("../imagens/Background/BG-1920-1080-new.jpg");
background-repeat: no-repeat;
background-size: cover;
width: 100%;
height: auto;
}


/* aqui troco a imagem pra cada resolução na ordem do maior pro menor */

@media screen and (max-width: 1920px) {
  body { width: 100%;
  background-repeat: no-repeat;
  background-size: cover;
background-image: url("../imagens/Background/BG-1920-1080-new.jpg");
  }
}
@media screen and (max-width: 1280px) {
  body {
  width: 100%;
  background-repeat: no-repeat;
  background-size: cover;
background-image: url("../imagens/Background/BG-1280-720.jpg");
  }
}

@media screen and (max-width: 1024px) {
  body {
  width: 100%;
  background-repeat: no-repeat;
  background-size: cover;
background-image: url("../imagens/Background/BG-1024-1366-new.jpg");
  }
}

@media screen
and (max-width: 1024px) and (max-height: 570px)
   {
  body {
  width: 100%;
  background-repeat: no-repeat;
  background-size: cover;
background-image: url("../imagens/Background/BG-1024-7570-new.jpg");
  }
}

@media screen and (max-width: 768px), screen and (max-height: 570px) {
  body {
  width: 100%;
  background-repeat: no-repeat;
  background-size: cover;
background-image: url("../imagens/Background/BG-768-570.jpg");
  }
}

@media screen and (max-width: 768px) {
  body {
  width: 100%;
  background-repeat: no-repeat;
  background-size: cover;
background-image: url( "../imagens/Background/BG-768-1024-new.jpg");
  }
}

@media screen and (max-width: 480px) {
  body {
  width: 100%;
  background-repeat: no-repeat;
  background-size: cover;
background-image: url("../imagens/Background/BG-480-320.jpg");
  }
}

@media screen and (max-width: 411px) {
  body { width: 100%;
  background-repeat: no-repeat;
  background-size: cover;
background-image: url("../imagens/Background/BG-411-823-new.jpg");
  }
}

@media screen and (max-width: 414px){
  body { width: 100%;
  background-repeat: no-repeat;
  background-size: cover;
background-image: url("../imagens/Background/BG-414-736-new.jpg");
  }
}

@media screen and (max-width: 425px) {
  body { width: 100%;
  background-repeat: no-repeat;
  background-size: cover;
background-image: url("../imagens/Background/BG-425-570-new.jpg");
  }
}

@media screen and (max-width: 375px), screen and (max-height: 570px) {
  body { width: 100%;
  background-repeat: no-repeat;
  background-size: cover;
background-image: url("../imagens/Background/BG-375-570-new.jpg");
  }
}
@media screen and (max-width: 375px) {
  body { width: 100%;
  background-repeat: no-repeat;
  background-size: cover;
background-image: url("../imagens/Background/BG-375-667-new.jpg");
  }
}

@media screen and (max-width: 375px){
  body { width: 100%;
  background-repeat: no-repeat;
  background-size: cover;
background-image: url("../imagens/Background/BG-375-812-new.jpg");
  }
}

@media screen and (max-width: 360px) {
  body { width: 100%;
  background-repeat: no-repeat;
  background-size: cover;
background-image: url("../imagens/Background/BG-360-640-new.jpg");
  }
}


@media screen and (max-width: 320px) {
  body { width: 100%;
  background-repeat: no-repeat;
  background-size: cover;
background-image: url("../imagens/Background/BG-320-480-new.jpg");
  }
}
 

  • Welcome to Stack Overflow! Your question seems to have some problems and your experience here in Stack Overflow may not be the best because of this. We want you to do well here and get what you want, but for that we need you to do your part. Here are some guidelines that will help you: Stack Overflow Survival Guide in English.

  • Their @media are very confused, because so many?? Something else, you have two @media equal! http://prntscr.com/q2rytk I think you should pause a little and treat the images to have a wider range and you can use less @media, the way it’s not legal...

  • How do I know how many I need since I want you to see it on every device?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.