-2

I dunno how exactly I can explain my issue or if the title is specific enough. But what I want to do is for example I have a game like Tic Tac Toe and if the game finish a message should pop up the entire screen which block any other interactions except there is a button only. Like that:

enter image description here

I think something with display: ???

Haidepzai
  • 764
  • 1
  • 9
  • 22
  • This may help https://stackoverflow.com/questions/36218066/how-to-make-the-splash-page-div-fade-after-being-clicked – Kurohige Mar 12 '20 at 11:24

3 Answers3

1

Ive made a simple example for you how it could be done:

<head>
<style>
.content {
color: red;
}

.overlay {
  z-index: 1;
  width:100vw;
  height: 100vh;
  position: absolute;
  top: 0;
  left:0;
  background-color:black;
  opacity: 0.8;
}

.msg {
  background-color: white;
  width: 70px;
  padding: 50px;
  font-weight: bold;
  text-align:center;
  position: absolute;
  top:40%;
  left: 45%;
}

</style>
</head>
<body>
<p class="content">some content</p>
<div class=overlay>
<p class="msg">TEST</p>
</div>
</body>
</html>

this shows a black overlay over the complete Screen with a "TEST"-Message, you can add more Items like Buttons to the "overlay"-div if you want to.

But keep in mind, to use the "position: absolute;" attribute.

You can show or hide it by setting the "display: none" (hide) css-attribute to the "overlay"-div or setting "display: revert;" to show it

Pitzas
  • 88
  • 7
-1

You need to create a fullscreen overlay. Link: https://www.w3schools.com/howto/howto_js_fullscreen_overlay.asp Then you can add a Javascript event so that your quiz restarts when the user clicks the restart button. Hope this helps!

Souvik Das
  • 24
  • 4
-1

You might want to look at this post, How can I disable an entire HTML page on an event like in the case of JavaScript alert? I found it just by searching your question on Google. You'll probably need to use jquery for the solution.

UnknownPerson
  • 164
  • 1
  • 3
  • 14