Can flexbox css be use to create a vertical and horizontal page overlay message












0















It seems simple enough to centre a message vertically and horizontally using css flexbox but im struggling to use it to create a full page overlay. The flexbox always pushes other content. Maybe flex isn't the thing to use and i should stick to older css?



The overlay needs to be display: none; or hidden so that it can be shown at the appropriate time using javascript.



<div id="overlay"><span id="overlay-message">No Internet Connection</span></div>


Im prepending this html to the body when its needed. I suppose this could be removed instead of hidden and then prepended again when needed.










share|improve this question





























    0















    It seems simple enough to centre a message vertically and horizontally using css flexbox but im struggling to use it to create a full page overlay. The flexbox always pushes other content. Maybe flex isn't the thing to use and i should stick to older css?



    The overlay needs to be display: none; or hidden so that it can be shown at the appropriate time using javascript.



    <div id="overlay"><span id="overlay-message">No Internet Connection</span></div>


    Im prepending this html to the body when its needed. I suppose this could be removed instead of hidden and then prepended again when needed.










    share|improve this question



























      0












      0








      0








      It seems simple enough to centre a message vertically and horizontally using css flexbox but im struggling to use it to create a full page overlay. The flexbox always pushes other content. Maybe flex isn't the thing to use and i should stick to older css?



      The overlay needs to be display: none; or hidden so that it can be shown at the appropriate time using javascript.



      <div id="overlay"><span id="overlay-message">No Internet Connection</span></div>


      Im prepending this html to the body when its needed. I suppose this could be removed instead of hidden and then prepended again when needed.










      share|improve this question
















      It seems simple enough to centre a message vertically and horizontally using css flexbox but im struggling to use it to create a full page overlay. The flexbox always pushes other content. Maybe flex isn't the thing to use and i should stick to older css?



      The overlay needs to be display: none; or hidden so that it can be shown at the appropriate time using javascript.



      <div id="overlay"><span id="overlay-message">No Internet Connection</span></div>


      Im prepending this html to the body when its needed. I suppose this could be removed instead of hidden and then prepended again when needed.







      css css3 flexbox






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 25 '18 at 0:12









      Michael_B

      147k47235343




      147k47235343










      asked Nov 24 '18 at 17:43









      AparistarAparistar

      70314




      70314
























          2 Answers
          2






          active

          oldest

          votes


















          0














          I suppose that's what you want.






          body {
          padding:0;
          margin:0;
          font-family:monospace;
          font-size:24px;
          }

          p {
          text-indent:40px;
          }

          #overlay {
          background:magenta;
          height:30vh;
          width:30vw;
          display:flex;
          align-items:center;
          position:fixed;
          top:50%;
          left:50%;
          transform:translate(-50%,-50%);
          }

          #overlay::before {
          content:'';
          position:fixed;
          background:transparent;
          height:100vh;
          width:100vw;
          left:-35vw;
          }

          #overlay-message {
          color:#fff;
          font-family:sans-serif;
          font-size:16px;
          text-align:center;
          width:100%;
          }

          <div id="overlay"><span id="overlay-message">No Internet Connection</span></div>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>
          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>





          With a little javascript, it disappears when you click on it.



          function hide () {
          document.getElementById("overlay").style.display = "none";
          }

          document.getElementById("overlay").onclick = function() {hide()};





          share|improve this answer


























          • Wizard. Thats the one. I'd struggle with that. Thank you

            – Aparistar
            Nov 24 '18 at 19:04



















          1

















          body {
          overflow:hidden;
          padding:0;
          margin:0;
          }

          #overlay {
          background:magenta;
          height:100vh;
          width:100vw;
          display:flex;
          justify-content:center;
          align-items:center;
          }

          #overlay-message {
          color:#fff;
          font-family:sans-serif;
          font-size:40px;
          }

          <div id="overlay"><span id="overlay-message">No Internet Connection</span></div>





          Is that what you want?



          or






          body {
          padding:0;
          margin:0;
          font-family:monospace;
          font-size:24px;
          }

          p {
          text-indent:40px;
          }

          #overlay {
          background:magenta;
          height:30vh;
          width:30vw;
          display:flex;
          align-items:center;
          position:fixed;
          top:50%;
          left:50%;
          transform:translate(-50%,-50%);
          }

          #overlay-message {
          color:#fff;
          font-family:sans-serif;
          font-size:16px;
          text-align:center;
          width:100%;
          }

          <div id="overlay"><span id="overlay-message">No Internet Connection</span></div>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>
          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>








          share|improve this answer


























          • Thank you for a complete answer. The later was the one i was looking for. As this overlay uses display:flex; in order to hide it i would need to remove it with query or something?

            – Aparistar
            Nov 24 '18 at 18:43











          • And #overlay is not full page so the content behind is clickable. These are my only issues.

            – Aparistar
            Nov 24 '18 at 18:49











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53460821%2fcan-flexbox-css-be-use-to-create-a-vertical-and-horizontal-page-overlay-message%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          I suppose that's what you want.






          body {
          padding:0;
          margin:0;
          font-family:monospace;
          font-size:24px;
          }

          p {
          text-indent:40px;
          }

          #overlay {
          background:magenta;
          height:30vh;
          width:30vw;
          display:flex;
          align-items:center;
          position:fixed;
          top:50%;
          left:50%;
          transform:translate(-50%,-50%);
          }

          #overlay::before {
          content:'';
          position:fixed;
          background:transparent;
          height:100vh;
          width:100vw;
          left:-35vw;
          }

          #overlay-message {
          color:#fff;
          font-family:sans-serif;
          font-size:16px;
          text-align:center;
          width:100%;
          }

          <div id="overlay"><span id="overlay-message">No Internet Connection</span></div>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>
          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>





          With a little javascript, it disappears when you click on it.



          function hide () {
          document.getElementById("overlay").style.display = "none";
          }

          document.getElementById("overlay").onclick = function() {hide()};





          share|improve this answer


























          • Wizard. Thats the one. I'd struggle with that. Thank you

            – Aparistar
            Nov 24 '18 at 19:04
















          0














          I suppose that's what you want.






          body {
          padding:0;
          margin:0;
          font-family:monospace;
          font-size:24px;
          }

          p {
          text-indent:40px;
          }

          #overlay {
          background:magenta;
          height:30vh;
          width:30vw;
          display:flex;
          align-items:center;
          position:fixed;
          top:50%;
          left:50%;
          transform:translate(-50%,-50%);
          }

          #overlay::before {
          content:'';
          position:fixed;
          background:transparent;
          height:100vh;
          width:100vw;
          left:-35vw;
          }

          #overlay-message {
          color:#fff;
          font-family:sans-serif;
          font-size:16px;
          text-align:center;
          width:100%;
          }

          <div id="overlay"><span id="overlay-message">No Internet Connection</span></div>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>
          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>





          With a little javascript, it disappears when you click on it.



          function hide () {
          document.getElementById("overlay").style.display = "none";
          }

          document.getElementById("overlay").onclick = function() {hide()};





          share|improve this answer


























          • Wizard. Thats the one. I'd struggle with that. Thank you

            – Aparistar
            Nov 24 '18 at 19:04














          0












          0








          0







          I suppose that's what you want.






          body {
          padding:0;
          margin:0;
          font-family:monospace;
          font-size:24px;
          }

          p {
          text-indent:40px;
          }

          #overlay {
          background:magenta;
          height:30vh;
          width:30vw;
          display:flex;
          align-items:center;
          position:fixed;
          top:50%;
          left:50%;
          transform:translate(-50%,-50%);
          }

          #overlay::before {
          content:'';
          position:fixed;
          background:transparent;
          height:100vh;
          width:100vw;
          left:-35vw;
          }

          #overlay-message {
          color:#fff;
          font-family:sans-serif;
          font-size:16px;
          text-align:center;
          width:100%;
          }

          <div id="overlay"><span id="overlay-message">No Internet Connection</span></div>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>
          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>





          With a little javascript, it disappears when you click on it.



          function hide () {
          document.getElementById("overlay").style.display = "none";
          }

          document.getElementById("overlay").onclick = function() {hide()};





          share|improve this answer















          I suppose that's what you want.






          body {
          padding:0;
          margin:0;
          font-family:monospace;
          font-size:24px;
          }

          p {
          text-indent:40px;
          }

          #overlay {
          background:magenta;
          height:30vh;
          width:30vw;
          display:flex;
          align-items:center;
          position:fixed;
          top:50%;
          left:50%;
          transform:translate(-50%,-50%);
          }

          #overlay::before {
          content:'';
          position:fixed;
          background:transparent;
          height:100vh;
          width:100vw;
          left:-35vw;
          }

          #overlay-message {
          color:#fff;
          font-family:sans-serif;
          font-size:16px;
          text-align:center;
          width:100%;
          }

          <div id="overlay"><span id="overlay-message">No Internet Connection</span></div>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>
          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>





          With a little javascript, it disappears when you click on it.



          function hide () {
          document.getElementById("overlay").style.display = "none";
          }

          document.getElementById("overlay").onclick = function() {hide()};





          body {
          padding:0;
          margin:0;
          font-family:monospace;
          font-size:24px;
          }

          p {
          text-indent:40px;
          }

          #overlay {
          background:magenta;
          height:30vh;
          width:30vw;
          display:flex;
          align-items:center;
          position:fixed;
          top:50%;
          left:50%;
          transform:translate(-50%,-50%);
          }

          #overlay::before {
          content:'';
          position:fixed;
          background:transparent;
          height:100vh;
          width:100vw;
          left:-35vw;
          }

          #overlay-message {
          color:#fff;
          font-family:sans-serif;
          font-size:16px;
          text-align:center;
          width:100%;
          }

          <div id="overlay"><span id="overlay-message">No Internet Connection</span></div>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>
          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>





          body {
          padding:0;
          margin:0;
          font-family:monospace;
          font-size:24px;
          }

          p {
          text-indent:40px;
          }

          #overlay {
          background:magenta;
          height:30vh;
          width:30vw;
          display:flex;
          align-items:center;
          position:fixed;
          top:50%;
          left:50%;
          transform:translate(-50%,-50%);
          }

          #overlay::before {
          content:'';
          position:fixed;
          background:transparent;
          height:100vh;
          width:100vw;
          left:-35vw;
          }

          #overlay-message {
          color:#fff;
          font-family:sans-serif;
          font-size:16px;
          text-align:center;
          width:100%;
          }

          <div id="overlay"><span id="overlay-message">No Internet Connection</span></div>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>
          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 24 '18 at 19:04

























          answered Nov 24 '18 at 18:55









          Dogukan CavusDogukan Cavus

          2,2241422




          2,2241422













          • Wizard. Thats the one. I'd struggle with that. Thank you

            – Aparistar
            Nov 24 '18 at 19:04



















          • Wizard. Thats the one. I'd struggle with that. Thank you

            – Aparistar
            Nov 24 '18 at 19:04

















          Wizard. Thats the one. I'd struggle with that. Thank you

          – Aparistar
          Nov 24 '18 at 19:04





          Wizard. Thats the one. I'd struggle with that. Thank you

          – Aparistar
          Nov 24 '18 at 19:04













          1

















          body {
          overflow:hidden;
          padding:0;
          margin:0;
          }

          #overlay {
          background:magenta;
          height:100vh;
          width:100vw;
          display:flex;
          justify-content:center;
          align-items:center;
          }

          #overlay-message {
          color:#fff;
          font-family:sans-serif;
          font-size:40px;
          }

          <div id="overlay"><span id="overlay-message">No Internet Connection</span></div>





          Is that what you want?



          or






          body {
          padding:0;
          margin:0;
          font-family:monospace;
          font-size:24px;
          }

          p {
          text-indent:40px;
          }

          #overlay {
          background:magenta;
          height:30vh;
          width:30vw;
          display:flex;
          align-items:center;
          position:fixed;
          top:50%;
          left:50%;
          transform:translate(-50%,-50%);
          }

          #overlay-message {
          color:#fff;
          font-family:sans-serif;
          font-size:16px;
          text-align:center;
          width:100%;
          }

          <div id="overlay"><span id="overlay-message">No Internet Connection</span></div>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>
          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>








          share|improve this answer


























          • Thank you for a complete answer. The later was the one i was looking for. As this overlay uses display:flex; in order to hide it i would need to remove it with query or something?

            – Aparistar
            Nov 24 '18 at 18:43











          • And #overlay is not full page so the content behind is clickable. These are my only issues.

            – Aparistar
            Nov 24 '18 at 18:49
















          1

















          body {
          overflow:hidden;
          padding:0;
          margin:0;
          }

          #overlay {
          background:magenta;
          height:100vh;
          width:100vw;
          display:flex;
          justify-content:center;
          align-items:center;
          }

          #overlay-message {
          color:#fff;
          font-family:sans-serif;
          font-size:40px;
          }

          <div id="overlay"><span id="overlay-message">No Internet Connection</span></div>





          Is that what you want?



          or






          body {
          padding:0;
          margin:0;
          font-family:monospace;
          font-size:24px;
          }

          p {
          text-indent:40px;
          }

          #overlay {
          background:magenta;
          height:30vh;
          width:30vw;
          display:flex;
          align-items:center;
          position:fixed;
          top:50%;
          left:50%;
          transform:translate(-50%,-50%);
          }

          #overlay-message {
          color:#fff;
          font-family:sans-serif;
          font-size:16px;
          text-align:center;
          width:100%;
          }

          <div id="overlay"><span id="overlay-message">No Internet Connection</span></div>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>
          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>








          share|improve this answer


























          • Thank you for a complete answer. The later was the one i was looking for. As this overlay uses display:flex; in order to hide it i would need to remove it with query or something?

            – Aparistar
            Nov 24 '18 at 18:43











          • And #overlay is not full page so the content behind is clickable. These are my only issues.

            – Aparistar
            Nov 24 '18 at 18:49














          1












          1








          1










          body {
          overflow:hidden;
          padding:0;
          margin:0;
          }

          #overlay {
          background:magenta;
          height:100vh;
          width:100vw;
          display:flex;
          justify-content:center;
          align-items:center;
          }

          #overlay-message {
          color:#fff;
          font-family:sans-serif;
          font-size:40px;
          }

          <div id="overlay"><span id="overlay-message">No Internet Connection</span></div>





          Is that what you want?



          or






          body {
          padding:0;
          margin:0;
          font-family:monospace;
          font-size:24px;
          }

          p {
          text-indent:40px;
          }

          #overlay {
          background:magenta;
          height:30vh;
          width:30vw;
          display:flex;
          align-items:center;
          position:fixed;
          top:50%;
          left:50%;
          transform:translate(-50%,-50%);
          }

          #overlay-message {
          color:#fff;
          font-family:sans-serif;
          font-size:16px;
          text-align:center;
          width:100%;
          }

          <div id="overlay"><span id="overlay-message">No Internet Connection</span></div>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>
          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>








          share|improve this answer


















          body {
          overflow:hidden;
          padding:0;
          margin:0;
          }

          #overlay {
          background:magenta;
          height:100vh;
          width:100vw;
          display:flex;
          justify-content:center;
          align-items:center;
          }

          #overlay-message {
          color:#fff;
          font-family:sans-serif;
          font-size:40px;
          }

          <div id="overlay"><span id="overlay-message">No Internet Connection</span></div>





          Is that what you want?



          or






          body {
          padding:0;
          margin:0;
          font-family:monospace;
          font-size:24px;
          }

          p {
          text-indent:40px;
          }

          #overlay {
          background:magenta;
          height:30vh;
          width:30vw;
          display:flex;
          align-items:center;
          position:fixed;
          top:50%;
          left:50%;
          transform:translate(-50%,-50%);
          }

          #overlay-message {
          color:#fff;
          font-family:sans-serif;
          font-size:16px;
          text-align:center;
          width:100%;
          }

          <div id="overlay"><span id="overlay-message">No Internet Connection</span></div>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>
          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>








          body {
          overflow:hidden;
          padding:0;
          margin:0;
          }

          #overlay {
          background:magenta;
          height:100vh;
          width:100vw;
          display:flex;
          justify-content:center;
          align-items:center;
          }

          #overlay-message {
          color:#fff;
          font-family:sans-serif;
          font-size:40px;
          }

          <div id="overlay"><span id="overlay-message">No Internet Connection</span></div>





          body {
          overflow:hidden;
          padding:0;
          margin:0;
          }

          #overlay {
          background:magenta;
          height:100vh;
          width:100vw;
          display:flex;
          justify-content:center;
          align-items:center;
          }

          #overlay-message {
          color:#fff;
          font-family:sans-serif;
          font-size:40px;
          }

          <div id="overlay"><span id="overlay-message">No Internet Connection</span></div>





          body {
          padding:0;
          margin:0;
          font-family:monospace;
          font-size:24px;
          }

          p {
          text-indent:40px;
          }

          #overlay {
          background:magenta;
          height:30vh;
          width:30vw;
          display:flex;
          align-items:center;
          position:fixed;
          top:50%;
          left:50%;
          transform:translate(-50%,-50%);
          }

          #overlay-message {
          color:#fff;
          font-family:sans-serif;
          font-size:16px;
          text-align:center;
          width:100%;
          }

          <div id="overlay"><span id="overlay-message">No Internet Connection</span></div>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>
          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>





          body {
          padding:0;
          margin:0;
          font-family:monospace;
          font-size:24px;
          }

          p {
          text-indent:40px;
          }

          #overlay {
          background:magenta;
          height:30vh;
          width:30vw;
          display:flex;
          align-items:center;
          position:fixed;
          top:50%;
          left:50%;
          transform:translate(-50%,-50%);
          }

          #overlay-message {
          color:#fff;
          font-family:sans-serif;
          font-size:16px;
          text-align:center;
          width:100%;
          }

          <div id="overlay"><span id="overlay-message">No Internet Connection</span></div>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>

          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>
          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos aliquam fugit illo voluptates harum ex porro officiis provident, odit quo sed error, assumenda maiores possimus architecto! Rem harum eos obcaecati.</p>






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 24 '18 at 18:38

























          answered Nov 24 '18 at 18:33









          Dogukan CavusDogukan Cavus

          2,2241422




          2,2241422













          • Thank you for a complete answer. The later was the one i was looking for. As this overlay uses display:flex; in order to hide it i would need to remove it with query or something?

            – Aparistar
            Nov 24 '18 at 18:43











          • And #overlay is not full page so the content behind is clickable. These are my only issues.

            – Aparistar
            Nov 24 '18 at 18:49



















          • Thank you for a complete answer. The later was the one i was looking for. As this overlay uses display:flex; in order to hide it i would need to remove it with query or something?

            – Aparistar
            Nov 24 '18 at 18:43











          • And #overlay is not full page so the content behind is clickable. These are my only issues.

            – Aparistar
            Nov 24 '18 at 18:49

















          Thank you for a complete answer. The later was the one i was looking for. As this overlay uses display:flex; in order to hide it i would need to remove it with query or something?

          – Aparistar
          Nov 24 '18 at 18:43





          Thank you for a complete answer. The later was the one i was looking for. As this overlay uses display:flex; in order to hide it i would need to remove it with query or something?

          – Aparistar
          Nov 24 '18 at 18:43













          And #overlay is not full page so the content behind is clickable. These are my only issues.

          – Aparistar
          Nov 24 '18 at 18:49





          And #overlay is not full page so the content behind is clickable. These are my only issues.

          – Aparistar
          Nov 24 '18 at 18:49


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53460821%2fcan-flexbox-css-be-use-to-create-a-vertical-and-horizontal-page-overlay-message%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

          Calculate evaluation metrics using cross_val_predict sklearn

          Insert data from modal to MySQL (multiple modal on website)