JSFiddle - React, Tailwind, and code Playground
by thvinic
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://html2canvas.hertzen.com/dist/html2canvas.min.js"></script>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Gerador de cartão</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Metal+Mania|Shrikhand|Shojumaru" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Nosifer" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Kaushan+Script" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Courgette|Oleo+Script" rel="stylesheet">
</head>
<body>
<div class="container">
<h1 class="text-center mt-2 mb-3"><strong>Gerador de Cartão de visita App Recibos</strong></h1>
<div id="cartão">
<div class="row">
<div class="col-md-6 col-xs-6 col-lg-6 col-xl-6 offset-md-3 offset-xs-3 offset-lg-3 offset-xl-3">
<!--===============FORM================-->
<div id="formBox">
<div class="card pt-1 pb-1">
<h4 class="text-center mt-0 mb-1" style="color: #2eff00">Insira suas informações</h4>
<form>
<div class="form-group">
<label for=""><h5>Nome<span style="color:red">*</span> :</h5></label>
<input oninput="validation1()" type="text" class="form-control pt-1 pb-1" id="name" placeholder="Insira seu nome">
</div>
<div class="form-group">
<label for="profession"><h5>Sua Area de Trabalho<span style="color:red">*</span> :</h5></label>
<input oninput="validation2()" type="text" class="form-control pt-1 pb-1" id="profession" placeholder="insira sua profissão">
</div>
<div class="form-group">
<label for="profile"><h5>Sua Imagem de Perfil</h5></label>
<input type="file" accept="image/*"...
CSS
body{
margin: 0;
padding: 0;
}
.container h1{
line-height: 90% ;
}
/*============FORM=============*/
#formBox .card{
max-width: 320px;
height: auto;
padding-right: 7px;
padding-left: 7px;
background: rgba(0,0,0,.6);
color:white;
left:50%;
transform: translateX(-50%);
border-radius: 5px;
}
#formBox input{
margin-top: -12px;
margin-bottom: -5px;
}
#formBox textarea{
margin-top: -12px;
}
#formBox button{
color: white;
background-color:#03b700;
margin-top: 5px;
margin-bottom: 6px;
padding: 5px 10px 5px 10px;
}
/*============CARD=============*/
#cardBox .card{
position: relative;
padding-top: 0;
margin-top: -955px;
text-align: center;
max-width: 970px;
width: 800px;
height: auto;
left: 50%;
transform: translateX(-50%);
border-radius: 10px;
}
#coverPhoto {
background-image: url('http://3.bp.blogspot.com/-ySjW17450h4/UvSeZxkj1LI/AAAAAAAAAGc/CjDxcyB-cSs/w1200-h630-p-k-no-nu/love-heart-symbol-hd-wallpapers-images+(8).jpg');
background-size: cover;
height: 150px;
width:auto;
border-radius:6px 6px 0px 0px;
}
#pic {
position:relative;
width: 130px;
height: 130px;
border-radius: 50%;
border: 4px solid rgba(255,255,255,0.6);
top: -70px;
left: -175px;
margin-bottom: -75px;
}
.all {
padding: 10px 7px;
}
.name {
margin-bottom: 0px;
font-size: 22px;
line-height:20px;
font-family: 'Shojumaru', cursive;
}
.profession {
font-size: 15px;
font-family: 'Nosifer', cursive;
margin-top: 1px;
}
.about {
font-size: 16px;
font-family: 'Kaushan Script', cursive;
line-height: 18px;
margin-top: 6px;
font-weight: 900;
}
.mobile{
font-size: 17px;
font-family: 'Courgette', cursive;
margin-top: 3 px;
}
.email{
font-size: 19px;
font-family: 'Oleo Script', cursive;
margin-top: -6px;
margin-bottom: 5px;
}
/*============OTHERS=============*/
p{
background-color: black;
color:...
JavaScript
//============COVER=================//
$('#cover').change(function () {
var file = this.files[0];
var reader = new FileReader();
reader.onloadend = function () {
$('#coverPhoto').css('background-image', 'url("' + reader.result + '")');
}
if (file) {
reader.readAsDataURL(file);
} else {
}
});
document.getElementById("cardBox").style.visibility = "hidden";
//============INPUT validation================//
function validation1() {
document.getElementById("name").style.border ="solid 2px #2eff00";
return false;
}
function validation2() {
document.getElementById("profession").style.border ="solid 2px #2eff00";
}
function validation3() {
document.getElementById("about").style.border ="solid 2px #2eff00";
}
function validation4() {
var mobile = document.getElementById("mobile").value;
if (mobile.length == 10) {
document.getElementById("mobile").style.border ="solid 2px #2eff00";
}
else {
document.getElementById("mobile").style.border ="solid 2px red";
}
}
function validation5() {
var email = document.getElementById("email").value;
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email)) {
document.getElementById("email").style.border ="solid 2px #2eff00";
}
else {
document.getElementById("email").style.border ="solid 2px red";
}
}
//=================MAIN FUNCTION=====================//
function generate() {
var name = document.getElementById("name").value;
var profession = document.getElementById("profession").value;
var about = document.getElementById("about").value;
var mobile = document.getElementById("mobile").value;
var email = document.getElementById("email").value;
var filesSelected = document.getElementById("profile").files;
var color = document.getElementById("color").value;
var textcolor = document.getElementById("textcolor").value;
...