JSFiddle - React, Tailwind, and code Playground
HTML
<br />
<a class="btn-sign" href="#login-box">login</a>
<div id="login-box" class="login-popup"> <a href="#" class="btn_close">
<img src="http://www.alisol.com.br/crm/imagens/close_pop_blue.png?v=4" class="btn_close" title="Fechar" alt="Fechar" /></a>
<form method="post" class="signin" action="#">
<fieldset class="textbox">
<h3>LOGIN</h3>
<label class="username">
<input id="username" name="username" value="" type="text" autocomplete="on" placeholder="usuário">
</label>
<label class="password">
<input id="password" name="password" value="" type="password" placeholder="senha">
</label>
<input id="enter" type="submit" value="Entrar" />
</fieldset>
</form>
</div>
CSS
.btn-sign {
width:460px;
margin-bottom:20px;
margin:0 auto;
padding:20px;
border-radius:5px;
background: -moz-linear-gradient(center top, #00c6ff, #018eb6);
background: -webkit-gradient(linear, left top, left bottom, from(#00c6ff), to(#018eb6));
background: -o-linear-gradient(top, #00c6ff, #018eb6);
filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#00c6ff', EndColorStr='#018eb6');
text-align:center;
font-size:36px;
color:#fff;
text-transform:uppercase;
}
.btn-sign a {
color:#fff;
text-shadow:0 1px 2px #161616;
}
#mask {
display: none;
background: #000;
position: fixed;
left: 0;
top: 0;
z-index: 10;
width: 100%;
height: 100%;
opacity: 0.5;
z-index: 999;
}
.login-popup {
display:none;
background: #FFF;
/
/*#BFD4FF;*/
padding: 10px;
border: 2px solid #05F;
float: left;
font-size: 1.2em;
position: fixed;
top: 50%;
left: 50%;
z-index: 99999;
box-shadow: 0px 0px 20px #BFD4FF;
/*#05F;*/
-moz-box-shadow: 0px 0px 20px #BFD4FF;
/*#05F; /* Firefox */
-webkit-box-shadow: 0px 0px 20px #BFD4FF;
/*#05F; /* Safari, Chrome */
border-radius:3px 3px 3px 3px;
-moz-border-radius: 3px;
/* Firefox */
-webkit-border-radius: 3px;
/* Safari, Chrome */
}
img.btn_close {
float: right;
margin: -18px -18px 0 0;
}
fieldset {
border:none;
}
form.signin .textbox label {
display:block;
padding-bottom:7px;
}
form.signin .textbox span {
display:block;
}
form.signin p, form.signin span {
color:#123;
font-size:11px;
line-height:18px;
}
form.signin .textbox input {
background:#BFD4FF;
border-bottom:1px solid #333;
border-left:1px solid #000;
border-right:1px solid #333;
border-top:1px solid #000;
color:#000;
/*#fff;*/
border-radius: 3px 3px 3px 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
font:13px Arial,...
JavaScript
$(document).ready(function () {
$('a.btn-sign').click(function () {
// Getting the variable's value from a link
var loginBox = $(this).attr('href');
//Fade in the Popup and add close button
$(loginBox).fadeIn(300);
//Set the center alignment padding + border
var popMargTop = ($(loginBox).height() + 24) / 2;
var popMargLeft = ($(loginBox).width() + 24) / 2;
$(loginBox).css({
'margin-top': -popMargTop,
'margin-left': -popMargLeft
});
// Add the mask to body
$('body').append('<div id="mask"></div>');
$('#mask').fadeIn(300);
return false;
});
// When clicking on the button close or the mask layer the popup closed
$('a.close, #mask').click(function () {
$('#mask, .login-popup').fadeOut(300, function () {
$('#mask').remove();
});
return false;
});
});