Love 💕💕 calculator

Sure, here's an example of a responsive love calculator code using JavaScript, HTML, and CSS: HTML: html Copy code Love Calculator

Love Calculator

CSS: css Copy code * { box-sizing: border-box; } body { font-family: Arial, sans-serif; background-color: #f1f1f1; } .container { margin: auto; max-width: 600px; padding: 20px; background-color: white; text-align: center; border-radius: 5px; box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1); } h1 { color: #ff6f69; } form { display: flex; flex-direction: column; align-items: center; } label { margin-top: 20px; font-size: 20px; } input { width: 100%; padding: 10px; margin-top: 5px; margin-bottom: 20px; border: none; border-radius: 5px; background-color: #f1f1f1; font-size: 16px; } button { padding: 10px 20px; background-color: #ff6f69; color: white; border: none; border-radius: 5px; font-size: 20px; cursor: pointer; } button:hover { background-color: #ff4c3b; } #love-result { margin-top: 40px; font-size: 30px; } JavaScript: javascript Copy code function calculateLove() { const yourName = document.getElementById("your-name").value.toLowerCase(); const partnerName = document.getElementById("partner-name").value.toLowerCase(); let loveScore = 0; for (let i = 0; i < yourName.length; i++) { for (let j = 0; j < partnerName.length; j++) { if (yourName[i] === partnerName[j]) { loveScore += 20; } } } const loveResult = document.getElementById("love-result"); if (loveScore > 80) { loveResult.innerHTML = `Congratulations! Your love score is ${loveScore}% ❤️`; } else { loveResult.innerHTML = `Your love score is only ${loveScore}%. Keep working on it! 💔`; } } This code creates a love calculator that takes the user's name and their partner's name as inputs, and calculates a love score based on the number of matching letters in their names. The love score is displayed on the screen using a message that varies depending on the score. The code is responsive and adjusts to different screen sizes

Comments

Popular Posts