Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Love Calculator project using html, css and js #81

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Love Calculator/images/boy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Love Calculator/images/girl.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Love Calculator/images/hearts.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
60 changes: 60 additions & 0 deletions Love Calculator/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Love Calculator</title>
<link rel="stylesheet" href="style.css">

<!-- font -->

<link href="https://fonts.googleapis.com/css2?family=Outfit:wght@400;700&display=swap" rel="stylesheet">
</head>
<body>

<h2 id="heading">Calculate Your Love Score</h2>

<div class="flex-container">
<div class="flex-items">
<div class="card">
<img src="images/boy.png" alt="Avatar" style="width:70%">
<div class="container">
<label for="name1-label">Your Name</label><br>
<input type="text" id="name1-label" name="name1"><br>
</div>
</div>
</div>
<div class="flex-items">
<div class="middleElement">
<img src="images/hearts.png" alt="hearts" style="width:70%">

</div>
</div>
<div class="flex-items">
<div class="card">
<img src="images/girl.png" alt="Avatar" style="width:70%">
<div class="container">
<label for="name2-label">Crush Name</label><br>
<input type="text" id="name2-label" name="name2"><br>
</div>
</div>
</div>

</div>


<div class="container-button">
<button id="check-button">Check Now</button>
</div>




<!-- footer -->
<footer>
<p>© Copyright Reserved LoveCalculator.com</p>
</footer>

<script src="index.js"></script>
</body>
</html>
23 changes: 23 additions & 0 deletions Love Calculator/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@


var lovePercentage = Math.floor(Math.random()*100)+1;
var heading = document.getElementById("heading");
var button = document.getElementById("check-button");
var inputs = document.querySelectorAll('input');

button.addEventListener('click',function(){
var firstName = inputs[0].value.toUpperCase();
var secondName = inputs[1].value.toUpperCase();
if(!(firstName=='' || secondName=='')){
while(lovePercentage < 80){
lovePercentage = Math.floor(Math.random()*100)+1;
}
var messege = secondName + " and " + firstName + " are "+ lovePercentage +"% compatible";
heading.innerHTML=messege;
lovePercentage = Math.floor(Math.random()*100)+1;

}
else{
heading.innerHTML= "Enter your name first";
}
})
87 changes: 87 additions & 0 deletions Love Calculator/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
.container {
padding: 2px 5px;

}
.container-button{
text-align: center;
padding-top: 5%;
}
h2{
color: #FF869E;
font-family: 'Outfit', sans-serif;
font-weight: 700;
text-align: center;
font-size: 3rem;
}
p{
color: hsl(220, 15%, 55%);
font-family: 'Outfit', sans-serif;
font-size: 15px;
text-align: center;
}
label,#check-button{
color: #FF869E;
font-family: 'Outfit', sans-serif;
font-weight: 700;
text-align: center;
font-size: 1rem;
}
footer{
padding-top: 2.5%;
}
.flex-container{
display: flex;

background-color:#FFC4C4;
justify-content: center;
justify-content: space-evenly;
flex-wrap: wrap;

padding: 3%;

}
.middleElement{
text-align: center;
/* background-color: hsl(0, 0%, 100%); */
height: auto;
width: 300px;
padding: 15px;
}


/* On mouse-over, add a deeper shadow */
/* .card:hover {
box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2);
} */

/* Add some padding inside the card container */

.card {
text-align: center;
background-color: hsl(0, 0%, 100%);
/* margin: 9% 40%; */
height: auto;
width: 300px;
padding: 15px;
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
transition: 0.3s;
border-radius: 10px; /* 5px rounded corners */

/* Add shadows to create the "card" effect */
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
transition: 0.3s;
}


#check-button {
background-color: #FF869E;
color: white;
border: 2px solid #4CAF50;
padding: 14px 40px;
font-size: 1.5rem;
border-radius: 30px;
}

#check-button:hover {
box-shadow: 0 12px 16px 0 rgba(0,0,0,0.24), 0 17px 50px 0 rgba(0,0,0,0.19);
}