window.onload = function() {
document.getElementById('button').onclick = function() {
document.getElementById('modalOverlay').style.display = 'none'
};
};
body {
background: url('https://images.unsplash.com/photo-1492518757308-3eaa20dbb0e2');
background-repeat: no-repeat;
background-size: cover;
font-family: Arial, Helvetica, sans-serif;
}
#modalOverlay {
position: fixed;
top: 0;
left: 0;
background: rgba(0, 0, 0, 0.5);
z-index: 99999;
height: 100%;
width: 100%;
}
.modalPopup {
position: absolute;
top: 30%;
left: 50%;
transform: translate(-50%, -50%);
background: #fff;
width: 50%;
padding: 0 0 30px;
-webkit-box-shadow: 0 2px 10px 3px rgba(0,0,0,.2);
-moz-box-shadow: 0 2px 10px 3px rgba(0,0,0,.2);
box-shadow: 0 2px 10px 3px rgba(0,0,0,.2);
}
.modalContent {padding: 0 2em;}
.headerBar {
width: 100%;
background: #edcb04 url(http://cognex.com/gfx/site/bg-global-header.png) repeat-x 0 0;
margin: 0;
text-align: center;
}
.headerBar img {
margin: 1em .7em;
}
h1 {
margin-bottom: .2em;
font-size: 26px;
text-transform: capitalize;
}
p {margin: .75em 0 1.5em;}
.buttonStyle {
border: transparent;
border-radius: 0;
background: #6d6d6d;
color: #eee !important;
cursor: pointer;
font-weight: bold;
font-size: 14px;
text-transform: uppercase;
padding: 6px 25px;
text-decoration: none;
background: -moz-linear-gradient(top, #6d6d6d 0%, #1e1e1e 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#6d6d6d), color-stop(100%,#1e1e1e));
background: -webkit-linear-gradient(top, #6d6d6d 0%,#1e1e1e 100%);
background: -o-linear-gradient(top, #6d6d6d 0%,#1e1e1e 100%);
background: -ms-linear-gradient(top, #6d6d6d 0%,#1e1e1e 100%);
background: linear-gradient(to bottom, #6d6d6d 0%,#1e1e1e 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#6d6d6d', endColorstr='#1e1e1e',GradientType=0 );
/* -webkit-box-shadow: 0 2px 4px 0 #999;
box-shadow: 0 2px 4px 0 #999; */
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-ms-transition: all 1s ease;
-o-transition: all 1s ease;
transition: all 1s ease;
}
.buttonStyle:hover {
background: #1e1e1e;
color: #fff;
background: -moz-linear-gradient(top, #1e1e1e 0%, #6d6d6d 100%, #6d6d6d 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#1e1e1e), color-stop(100%,#6d6d6d), color-stop(100%,#6d6d6d));
background: -webkit-linear-gradient(top, #1e1e1e 0%,#6d6d6d 100%,#6d6d6d 100%);
background: -o-linear-gradient(top, #1e1e1e 0%,#6d6d6d 100%,#6d6d6d 100%);
background: -ms-linear-gradient(top, #1e1e1e 0%,#6d6d6d 100%,#6d6d6d 100%);
background: linear-gradient(to bottom, #1e1e1e 0%,#6d6d6d 100%,#6d6d6d 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#1e1e1e', endColorstr='#6d6d6d',GradientType=0 );
}
.returnToProfile {text-align: center; margin:3em;}
.returnToProfile a, .returnToProfile a:visited {color: #ddd;}
.returnToProfile a:hover {color: #fff;}
<html>
<head>
<meta charset="utf-8">
<title>Modal popup</title>
<script type="text/javascript">
// Place the JS here or just before the BODY close.
</script>
</head>
<body>
<div id="modalOverlay">
<div class="modalPopup">
<div class="headerBar">
<img src="https://placehold.it/200x25/edcb04/333333/?text=LOGO" alt="Logo">
</div>
<div class="modalContent">
<h1>Modal window title here</h1>
<p>Modal appears on page load, presents information and is dismissed after the "Close" button is clicked. Styled modal messaging, images and other information here.</p>
<button class="buttonStyle" id="button">Close</button>
</div>
</div>
</div>
<!--p class="returnToProfile"><a href="https://codepen.io/ptamaro" target="_parent">Return to profile</a></p-->
</body>
</html>