js-form-dialog
Version:
A simple vanilla js library to generate custom form on the go.
96 lines (86 loc) • 1.92 kB
CSS
/* DIALOG DEFAULT STYLE */
.modal {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 1; /* Sit on top */
left: 0;
top: 0;
width: 100%; /* Full width */
height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */
background-color: rgb(0, 0, 0); /* Fallback color */
background-color: rgba(0, 0, 0, 0.4); /* Black w/ opacity */
}
/* Modal Content/Box */
.modal-content {
background-color: #fefefe;
margin: 15% auto; /* 15% from the top and centered */
padding: 20px;
border: 1px solid #888;
width: 80%; /* Could be more or less, depending on screen size */
position: relative;
}
/* The Close Button */
.title {
color: #000;
float: left;
font-size: 18px;
font-weight: bold;
width: 100%;
position: relative;
}
.title.center{
text-align: center;
}
.close {
color: #aaa;
float: right;
font-size: 28px;
font-weight: bold;
position: absolute;
right: 10px;
top: 10px;
}
.close:hover,
.close:focus {
color: black;
text-decoration: none;
cursor: pointer;
}
/* FORM STYLE */
#form_body {
padding: 15px;
}
#form_body * {
/* float: left; */
}
#form_body > .full {
width: 97%;
}
#form_body > .half {
margin-top: 2%;
width: 46%;
float: left;
}
#form_body > .half:last-child {
margin-left: 4%;
}
#form_body input[type="text"],
#form_body input[type="number"],
#form_body input[type="password"] {
padding: 6px 10px;
margin: 8px 0;
box-sizing: border-box;
}
#form_body input[type="text"]:focus {
border-color: lightblue;
}
#form_body input[type=button], #form_body input[type=submit], #form_body input[type=reset] {
background-color: #4CAF50;
border: none;
color: white;
padding: 8px 12px;
text-decoration: none;
margin: 4px 2px;
cursor: pointer;
}