Skip to content

Instantly share code, notes, and snippets.

@harunpehlivan
Created December 19, 2022 20:57
Show Gist options
  • Save harunpehlivan/ce38ca42a4c8936a1640ff46c1c51d8d to your computer and use it in GitHub Desktop.
Save harunpehlivan/ce38ca42a4c8936a1640ff46c1c51d8d to your computer and use it in GitHub Desktop.
Business Card Generator
<header class="main-header">
<h1>
Business Card Generator
</h1>
</header>
<div class="palsta1">
<h2>
Fill in your details below
</h2>
<form>
<div class="form-field">
<label class="label-name">Name</label>
<input class="field name" type="text"/>
</div>
<div class="form-field">
<label class="label-name">Role</label>
<input class="field role" type="text"/>
</div>
<div class="form-field">
<label class="label-name">Motto</label>
<input class="field motto" type="text"/>
</div>
<div class="form-field">
<label class="label-name">Phone</label>
<input class="field tel" type="text"/>
</div>
<div class="form-field">
<label class="label-name">Logo</label>
<input class="field pic" type="text"/>
</div>
<input type="submit"/>
</form>
</div>
<div class="palsta2">
<div class="card">
<p class="info line1">
HARUN PEHLİVAN
</p>
<p class="info line2">
FOUNDER CEO
</p>
<p class="info line3">
HP IT GROUP (TEBIM TEBITAGEM) TTGRT
</p>
<p class="phone line4">
Tel.: +90 (552) 741 0904
</p>
<img class="logo line5" src/>
</div>
</div>
$('form').on('submit', function(event) {
event.preventDefault()
var name = $('.name').val();
var role = $('.role').val();
var motto = $('.motto').val();
var tel = $('.tel').val();
var pic = $('.pic').val();
var nameElement = $('.line1')
var roleElement = $('.line2')
var mottoElement = $('.line3')
var telElement = $('.line4')
var picElement = $('.line5')
nameElement.text(name)
roleElement.text(role)
mottoElement.text(motto)
telElement.text(tel)
picElement.attr('src', pic)
console.log(name, role, motto, tel, pic)
})
// string
// intiger
// variable
// function
// array
// object
// boolean
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
.main-header {
padding-top: 20px;
padding-bottom: 20px;
padding-left: 50px;
background-color: mediumAquaMarine;
}
body {
margin: 0;
font-family: Garamond Header;
background-color: lightgray;
}
* {
box-sizing: border-box;
}
.palsta1,
.palsta2 {
padding: 20px;
width: 50%;
float: left;
}
.palsta1 {
border-width: 0px 5px 0px 0px;
border-color: black;
border-style: solid;
}
.card {
background-color: mintcream;
width: 400px;
height: 240px;
margin-left: auto;
margin-right: auto;
padding: 10px;
position: relative;
border-radius: 15px;
box-shadow: 5px 5px 5px gray;
margin-top: 110px;
}
.info {
margin: 0 0 5px 0;
font-size: 35px;
color: teal;
}
.phone {
margin: 0 0 5px 0;
position: absolute;
bottom: 10px;
left: 10px;
color: navy;
font-size: 30px;
}
.logo {
width: 80px;
position: absolute;
bottom: 10px;
right: 10px;
}
.label-name {
display: block;
}
.form-field {
margin: 0 0 15px 0;
}
.field {
padding: 10px;
width: 300px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment