Build A Palindrome Checker
Build A Palindrome Checker
Build A Palindrome Checker
<!DOCTYPE html>
<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" />
** end of undefined **
** start of undefined **
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: Verdana, Geneva, Tahoma, sans-serif;
background-color: #230a0a;
color: #ffffff;
}
.container {
width: 100%;
min-height: 100vh;
position: relative;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
.freecodecamp-logo {
height: 30px;
margin-bottom: 20px;
}
.title {
text-align: center;
padding: 10px 0;
font-size: 2.5rem;
margin-bottom: 20px;
}
.palindrome-div {
width: min(100vw, 450px);
min-height: 100px;
border-radius: 20px;
display: flex;
align-items: center;
justify-content: center;
flex-wrap: wrap;
padding: 20px;
margin: 10px 0;
background-color: white;
box-shadow: 0 6px 6px #ad000e;
}
label {
color: #0a0a23;
margin-bottom: 20px;
}
.palindrome-btn {
width: 90px;
border: none;
padding: 10px;
border-radius: 15px;
background-color: #c71b62;
color: #fff;
cursor: pointer;
}
.palindrome-input {
height: 30px;
width: 250px;
text-align: center;
font-size: 1.2rem;
margin: 10px;
border: none;
border-bottom: 2px solid #c71b62;
}
.palindrome-input:focus {
border-bottom: 3px solid #c71b62;
}
.palindrome-input::placeholder {
text-align: center;
}
.user-input {
font-size: 1.4rem;
margin-top: 10px;
text-align: center;
}
.results-div {
overflow-y: auto;
word-wrap: break-word;
min-height: 50px;
color: maroon;
}
.hidden {
display: none;
}
.palindrome-definition-div {
width: min(100vw, 450px);
font-size: 1.3rem;
min-height: 140px;
background-color:maroon;
margin-top: 20px;
padding: 20px;
border-radius: 20px;
display: flex;
align-items: center;
justify-content: center;
}
.palindrome-definition {
vertical-align: middle;
text-align: center;
}
** end of undefined **
** start of undefined **
checkPalindromeBtn.addEventListener('click', () => {
checkForPalindrome(userInput.value);
userInput.value = '';
});
userInput.addEventListener('keydown', e => {
if (e.key === 'Enter') {
checkForPalindrome(userInput.value);
userInput.value = '';
}
});
/*
function isPalindrome(s) {
// Remove non-alphanumeric characters and convert to lowercase
s = s.replace(/[^a-zA-Z0-9]/g, '').toLowerCase();
// Check if the string is equal to its reverse
return s === s.split('').reverse().join('');
}
** end of undefined **