Jika biasanya popup dibuat menggunakan jQuery kali ini saya akan membuat popup dengan css.
berikut source code nya:
<!DOCTYPE html>
<html>
<head>
<title></title>
<style>
#button {margin: 5% auto; width: auto; text-align: center;}
#button a {
width: auto;
height: 30px;
vertical-align: middle;
background-color: #000;
color: #fff;
text-decoration: none;
padding: 10px;
border-radius: 5px;
border: 1px solid transparent;
}
/* Jendela Pop Up */
#popup {
width: 100%;
height: 100%;
position: fixed;
background: rgba(0,0,0,.7);
top: 0;
left: 0;
z-index: 9999;
visibility: hidden;
}
#window {
width: 400px;
height: 100px;
background: #fff;
border-radius: 10px;
position: relative;
padding: 10px;
text-align: center;
margin: 15% auto;
}
#window span {
margin: 30px 0 0 0;
font-size: 40px;
font-weight: bold;
}
/* Button Close */
#close-button {
width: 6%;
height: 20%;
line-height: 23px;
background: #000;
border-radius: 50%;
border: 3px solid #fff;
display: block;
text-align: center;
color: #fff;
text-decoration: none;
position: absolute;
top: -10px;
right: -10px;
}
/* Memunculkan Jendela Pop Up*/
#popup:target {
visibility: visible;
}
</style>
</head>
<body>
<div id="button"><a href="#popup">Coba Klik</a></div>
<div id="popup">
<div id="window">
<a href="#" id="close-button" title="Close">X</a>
<span>Ini contoh popup</span>
</div>
</div>
</body>
</html>