body {
font-family: ‘Arial’, sans-serif;
background-color: #f2f2f2;
text-align: center;
margin: 0;
padding: 0;
}
h1 {
color: #333;
margin-top: 20px;
}
#loveForm {
background-color: #fff;
padding: 20px;
border-radius: 8px;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.2);
margin-top: 20px;
}
label {
display: block;
margin-bottom: 10px;
font-weight: bold;
color: #333;
}
input[type=”text”] {
width: 100%;
padding: 8px;
border: 1px solid #ccc;
border-radius: 4px;
margin-bottom: 20px;
}
button {
background-color: #4CAF50;
color: white;
border: none;
padding: 10px 20px;
border-radius: 4px;
cursor: pointer;
transition: background-color 0.3s;
}
button:hover {
background-color: #45a049;
}
#result {
font-size: 24px;
margin-top: 20px;
color: #333;
}
canvas {
margin-top: 20px;
}
Love Percentage Calculator
function calculateLove() {
const yourName = document.getElementById(“yourName”).value;
const partnerName = document.getElementById(“partnerName”).value;
// Calculate love percentage (this is just a simple random calculation)
const lovePercentage = Math.floor(Math.random() * 101);
// Display the result
document.getElementById(“result”).innerHTML = `Love Percentage between ${yourName} and ${partnerName}: ${lovePercentage}%`;
// Create a pie chart
const ctx = document.getElementById(‘loveChart’).getContext(‘2d’);
const chart = new Chart(ctx, {
type: ‘pie’,
data: {
labels: [`${yourName}’s Love`, `${partnerName}’s Love`],
datasets: [{
data: [lovePercentage, 100 – lovePercentage],
backgroundColor: [‘#FF6384’, ‘#36A2EB’],
}],
},
});
}