3

I'm using the fullscreen api and the default color for the border is black as seen in this image:enter image description here

Image is from http://blogs.sitepointstatic.com/examples/tech/full-screen/index2.html.

I would like to change this background color to a different color. Assuming the div has id #content, I've tried using

#content::backdrop {
  background-color: red;
}

but this did not work for me.

How do I change the color?

Zanon
  • 29,231
  • 20
  • 113
  • 126
Alan Liang
  • 358
  • 2
  • 15

1 Answers1

3

You need to use the :fullscreen CSS pseudo-class with vendor info. You can see a nice tutorial with an example here and docs here.

I've added the following to your example and it worked for me:

#myimage:fullscreen {
  background-color: green;
  width: 100vw;
  height: 100vh;
}

#myimage:-webkit-full-screen {
  background-color: green;
  width: 100vw;
  height: 100vh;
}

#myimage:-moz-full-screen {
  background-color: green;
  width: 100vw;
  height: 100vh;
}

#myimage:-ms-fullscreen {
  background-color: green;
  width: 100vw;
  height: 100vh;
}
Zanon
  • 29,231
  • 20
  • 113
  • 126
  • Has this changed at all? Is there one for chrome? I'm using the `*` selector... and having no success. – Shmack Aug 09 '21 at 14:56
  • Odd enough, it won't change the background color, yet I can control its overflow... – Shmack Oct 06 '21 at 05:39