<div class="container">
  <p><em>Click the button below to enter the element into fullscreen mode. </em><button onclick="var el = document.getElementById('element'); el.requestFullscreen();">
    Go Full Screen!
  <div class="element" id="element"><p>I change color in fullscreen mode!</p></div>
.container {
  margin: 40px auto;
  max-width: 600px;
.element {
  width: 100%;
  background-color: skyblue;
  text-align: center;
  color: white;
  font-size: 3em;
.element:-ms-fullscreen p {
  visibility: visible;
.element:fullscreen {
  background-color: #e4708a;
  width: 100vw;
  height: 100vh;

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.