JSFiddle - React, Tailwind, and code Playground

by Richard Houltz

HTML

<div class="overlay"></div>

<div class="popup">
    <div>Login</div>
    Username: <input></input>
    Password: <input></input>
    
    <button id="login">Login</button>
</div>
<p id="message">Not logged in...</p>

CSS

html,
body {
    height: 100%;
}
.overlay {
 	position:absolute;
	display:none; 

    /* color with alpha transparency */
    background-color: rgba(0, 0, 0, 0.7);

    /* stretch to screen edges */
    top: 0;
	left: 0;
    bottom: 0;
    right: 0;
}
.popup {
    position: absolute;
    width: 300px;
    height: 150px;
    display: none;
    background-color: white;
    text-align: center;

    /* center it ? */
    top: 50%;
    left: 50%;
    margin-left: -150px;
    margin-top: -75px;
}

JavaScript

$(".overlay, .popup").fadeIn(1000);

$("#login").click(function(){
    $(".overlay, .popup").fadeOut();
    $("#message").text("Logged in!!");
})