overlay_smp

In this example below you will see how to do a overlay_smp with some HTML / CSS and Javascript

Thumbnail
This awesome code was written by JunkiSuzuki, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright JunkiSuzuki ©
  • HTML
  • CSS
<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  <title>overlay_smp</title>
  
  
  
      <link rel="stylesheet" href="css/style.css">

  
</head>

<body>

  <div id="container">
	<a href="#gray" class="abtn">
		<div class="btn">クリック!</div>
	</a>
</div>
<div id="gray">
</div>
<div id="green">
	<a href="#" class="abtn">
		<div class="close">閉じる</div>
	</a>
</div>
  
  

</body>

</html>

/*Downloaded from https://www.codeseek.co/JunkiSuzuki/overlay_smp-EmbqJe */
body {
		font-size:			x-large;
		background:			lightgoldenrodyellow;
}
.abtn {
		text-decoration:	none;
}	
.btn {
		padding:			10px 20px;
		color:				white;
		background:			orangered;
		border:				1px solid orangered;
		border-radius:		10px;
		display:			inline-block;
		
}
	.btn:hover {
		color:				orangered;
		background:			white;
		box-shadow:			0px 0px 5px orangered;
	}
#gray {
		position:			fixed;
		top:				0;
		left:				0;
		height:				100%;
		width:				100%;
		background:			gray;
		opacity:			0.5;
		z-index:			1;
		display:			none;
}
#green {
		height:				200px;
		width:				300px;
		background:			green;
		border:				1px solid darkgreen;
		position:			fixed;
		top:				50%;
		left:				50%;
		margin-top:			-100px;
		margin-left:		-150px;
		z-index:			2;
		display:			none;
}
.close {
		padding:			15px;
		color:				white;
		background:			black;
		display:			inline-block;
}
#gray:target, #gray:target + #green {
	display:			block;
}

Comments