Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="container">
  <h1>Full Screen Modal Demo</h1>
  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua...</p>
  <p></p>
<button
        aria-label="Click to Toggle Full Screen View of Section"
        class="fullscreener button buttonBlue"
      >
        Open Modal
      </button>
  <section 
    role="dialog"
    aria-modal="true"
           
aria-labelledby="modalLabel"           class="fullscreenEnabled fullscreenModal"
>
  <div class="modalContent">
    <h2
  id="modalLabel"       class="fullscreenMoreInfo">This is the promised full screen mode!</h2>
    <span role="button" tabindex="0" aria-label="Close the modal" class="fullscreener close"></span>
    <div class="modalBody">
       <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam in ligula ex. Nullam feugiat malesuada massa at ultricies. Nam sed vestibulum velit. Aliquam egestas aliquam vestibulum. Sed nibh mi, tristique iaculis ornare porttitor, rhoncus nec eros. Fusce consequat elit ut justo iaculis, at ultrices nunc maximus. Proin ut tellus mattis, dapibus metus nec, dapibus elit. Cras eget egestas diam. Morbi aliquam dolor aliquam justo viverra, id aliquam ipsum malesuada. Etiam commodo iaculis diam id pretium.</p>

<p>Proin eget commodo ligula. Duis et consectetur tortor, id dictum urna. Praesent non est ligula. Nullam semper tellus sit amet magna feugiat, in hendrerit lacus fringilla. Nulla rhoncus consectetur tortor, quis iaculis diam dapibus vel. Fusce vitae sodales tortor, vitae mollis magna. Proin vel facilisis dolor. Aenean ultrices lacinia ornare. Suspendisse potenti. Proin ornare enim in libero tincidunt, a gravida nunc aliquam. Sed commodo egestas augue eu lacinia.</p>

<p>Nam ultricies efficitur diam at pellentesque. Duis tincidunt, tellus a pretium fringilla, lorem erat elementum augue, ultrices varius magna risus non sapien. Maecenas sollicitudin arcu id ligula malesuada consequat. Etiam malesuada ante in ipsum fringilla pharetra. Nunc dignissim massa eu dapibus pharetra. Donec non congue ante. Donec turpis sem, aliquet eget augue id, mollis efficitur libero. Etiam bibendum malesuada tincidunt. Nam consectetur molestie consectetur. Vivamus libero nunc, congue id rhoncus quis, condimentum aliquet metus. Maecenas scelerisque sem non orci ullamcorper, eget hendrerit magna pellentesque. Interdum et malesuada fames ac ante ipsum primis in faucibus. Pellentesque non sapien massa. In eu pulvinar nibh, sed pharetra ex. Nunc non maximus augue. </p>
      </div>
    </div>
  
  </section>

</div>
              
            
!

CSS

              
                
* {
  box-sizing: border-box;
}

body {
  font: PT Sans;
  background-color: #000;
  color: #ffefef;
}

.container {
  max-width: 72rem;
  margin: 0 auto;
  padding: 2rem;
}



.fullscreenModal {
  display: none;
}

.fullscreenModal:fullscreen {
  display:block;
  padding: 1rem;
}

/* Styles for buttons taken from Logrocket article 

CSS Reference Guide: Button styling

https://blog.logrocket.com/css-reference-guide-button-styling/ */

.button {
  padding: 6px 12px;
  margin-bottom: 0;
  font-weight: 400;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  display: inline-block;
  background-image: none;
  border-radius: 3px;
  box-shadow: none;
  border: 1px solid transparent;
}

.buttonBlue {
  color: #fff;
  background-color: blue;
  border-color: #2e6da4;    
}

.buttonBlue:focus {
  color: black;
  background-color: lightblue;
}

.modalContent {
  margin: 1rem;
  border: 2px dashed white;
  height: 95vh;
}
.close {
  position: relative;
  display: block;
}

.close::after {
  right: 1rem;
  top: -3rem;
  width: 2rem;
  height: 2rem;
  position: absolute;
  display: flex;
  z-index: 1;
  align-items: center;
  justify-content: center;
  background-color: transparent;
  border-radius: 50%;
  border: 2px solid white;
  color: white;
  content: "X";
  cursor: pointer;
}

.close:focus:after {
  color: yellow;
  border-color: yellow;
}

.fullscreenMoreInfo {
  text-indent: 1rem;
  padding-right: 1rem;
  padding-top: .5rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid white;
  border-right: 1px solid white;
  width: max-content;
  margin-top: 2px;
}

.modalBody {
  width: 90vw;
  margin-left: auto;
  margin-right: auto;
}
              
            
!

JS

              
                const makeFullScreen = (el) => {
   if (!document.fullscreenElement) {
     el.requestFullscreen();
     return;
  } 
    document.exitFullscreen();
 
}

const  buttons = document.querySelectorAll(".fullscreener");
const fullScreenEnabledEl = document.querySelector(".fullscreenEnabled");
buttons.forEach( (button) => {
button.addEventListener("click", () => {
 makeFullScreen(fullScreenEnabledEl);
});
button.addEventListener('keydown', (e) => {
  if (e.key === "Enter") {
    makeFullScreen(fullScreenEnabledEl);
  }
});

});
              
            
!
999px

Console