Css Answer Practical PDF
Css Answer Practical PDF
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Email Auto-Generator</title>
<style>
body {
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background-color: #f4f4f9;
.container {
background: #fff;
border-radius: 10px;
width: 100%;
max-width: 400px;
.container h2 {
text-align: center;
margin-bottom: 20px;
color: #333;
.form-group {
margin-bottom: 15px;
.form-group label {
display: block;
font-weight: bold;
margin-bottom: 5px;
color: #555;
.form-group input {
width: 100%;
padding: 10px;
border-radius: 5px;
font-size: 14px;
color: #333;
.form-group input:focus {
border-color: #007bff;
outline: none;
.email-output {
margin-top: 20px;
padding: 10px;
background: #f0f8ff;
border-radius: 5px;
color: #007bff;
font-weight: bold;
text-align: center;
</style>
</head>
<body>
<div class="container">
<h2>Email Auto-Generator</h2>
<div class="form-group">
</div>
<div class="form-group">
</div>
</div>
<script>
function generateEmail() {
document.getElementById('emailDisplay').innerText =
`${firstName}.${lastName}@example.com`;
} else {
</script>
</body>
</html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background-color: #f0f4f8;
.container {
background: #ffffff;
border-radius: 10px;
width: 100%;
max-width: 400px;
.container h2 {
text-align: center;
margin-bottom: 20px;
color: #333;
.form-group {
margin-bottom: 15px;
}
.form-group label {
display: block;
font-weight: bold;
margin-bottom: 5px;
color: #555;
.form-group input {
width: 100%;
padding: 10px;
border-radius: 5px;
font-size: 14px;
color: #333;
.form-group input[readonly] {
background-color: #f9f9f9;
color: #777;
cursor: not-allowed;
.btn {
display: block;
width: 100%;
padding: 10px;
margin-top: 10px;
background-color: #007bff;
color: white;
border: none;
border-radius: 5px;
font-size: 16px;
cursor: pointer;
.btn:hover {
background-color: #0056b3;
</style>
</head>
<body>
<div class="container">
<div class="form-group">
</div>
</div>
<script>
function updateValue() {
</script>
</body>
</html>
3] Write a code to find out whether the year is leap
year or not.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
body {
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background-color: #f0f4f8;
.container {
background: #ffffff;
border-radius: 10px;
width: 100%;
max-width: 400px;
text-align: center;
}
.container h2 {
color: #333;
margin-bottom: 20px;
.form-group {
margin-bottom: 15px;
.form-group input {
width: 100%;
padding: 10px;
border-radius: 5px;
font-size: 14px;
color: #333;
.form-group input:focus {
border-color: #007bff;
outline: none;
.btn {
display: block;
width: 100%;
padding: 10px;
background-color: #007bff;
color: white;
border: none;
border-radius: 5px;
font-size: 16px;
cursor: pointer;
.btn:hover {
background-color: #0056b3;
.result {
margin-top: 20px;
font-size: 18px;
font-weight: bold;
.result.leap {
color: #28a745;
.result.not-leap {
color: #dc3545;
</style>
</head>
<body>
<div class="container">
<div class="form-group">
</div>
</div>
<script>
function checkLeapYear() {
return;
if ((year % 4 === 0 && year % 100 !== 0) || (year % 400 === 0)) {
} else {
</script>
</body>
</html>
<html>
<head>
<title>Fibonacci Series</title>
<style>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: lightblue;
.container {
text-align: center;
background: white;
padding: 20px;
border-radius: 8px;
.btn {
padding: 10px 20px;
background: blue;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 16px;
margin-top: 10px;
.btn:hover {
background: darkblue;
.result {
margin-top: 15px;
font-size: 18px;
color: black;
</style>
</head>
<body>
<div class="container">
</div>
<script>
function generateFibonacci() {
</script>
</body>
</html>
<html>
<head>
<style>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: lightgray;
.container {
text-align: center;
background: white;
padding: 20px;
border-radius: 8px;
select {
padding: 10px;
font-size: 16px;
border-radius: 5px;
background: lightyellow;
color: black;
cursor: pointer;
.result {
margin-top: 15px;
font-size: 18px;
color: darkgreen;
</style>
</head>
<body>
<div class="container">
<br><br>
<select id="options" onchange="showMessage()">
</select>
</div>
<script>
function showMessage() {
resultBox.style.color = "red";
} else {
resultBox.style.color = "darkgreen";
</script>
</body>
</html>
6] Write a program to disable and enabled text field.
<!DOCTYPE html>
<html>
<head>
<style>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: lightcoral;
.container {
text-align: center;
background: white;
padding: 20px;
border-radius: 8px;
input[type="text"] {
padding: 10px;
font-size: 16px;
border-radius: 5px;
width: 200px;
margin-bottom: 10px;
input[type="text"]:disabled {
background-color: lightgray;
color: darkgray;
cursor: not-allowed;
.btn {
background: green;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 16px;
.btn:hover {
background: darkgreen;
</style>
</head>
<body>
<div class="container">
</div>
<script>
function toggleTextField() {
</script>
</body>
</html>
<html>
<head>
<style>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: lightblue;
margin: 0;
}
.container {
text-align: center;
.scroll-box {
width: 300px;
height: 200px;
overflow: auto;
background: white;
padding: 10px;
.content {
height: 600px;
width: 100%;
text-align: center;
font-size: 18px;
line-height: 2;
.btn {
background: darkblue;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
.btn:hover {
background: navy;
</style>
</head>
<body>
<div class="container">
<div class="content">
</div>
</div>
</div>
<script>
function scrollByAmount() {
}
function scrollToTop() {
</script>
</body>
</html>
<html>
<head>
<style>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: lightgreen;
margin: 0;
.container {
text-align: center;
background: white;
padding: 20px;
border-radius: 8px;
img {
width: 300px;
height: auto;
margin: 20px 0;
border-radius: 5px;
.btn {
margin: 5px;
background: darkgreen;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
.btn:hover {
background: green;
</style>
</head>
<body>
<div class="container">
<br>
</div>
<script>
function changeToImage1() {
img.src = "https://via.placeholder.com/300/FF5733/FFFFFF?text=Image+1";
function changeToImage2() {
img.src = "https://via.placeholder.com/300/33C3FF/FFFFFF?text=Image+2";
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: lightblue;
margin: 0;
.container {
text-align: center;
background: white;
padding: 20px;
border-radius: 8px;
width: 400px;
input[type="text"] {
padding: 10px;
font-size: 16px;
width: 70%;
border-radius: 5px;
margin-bottom: 15px;
.btn {
background-color: green;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
.btn:hover {
background-color: darkgreen;
.result {
margin-top: 15px;
font-size: 18px;
color: darkgreen;
</style>
</head>
<body>
<div class="container">
<br>
<button class="btn" onclick="countVowels()">Count Vowels</button>
</div>
<script>
function countVowels() {
let count = 0;
count++;
</script>
</body>
</html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Cookie Operations</title>
<style>
body {
text-align: center;
padding: 20px;
background-color: #f4f4f4;
button {
margin: 10px;
background-color: #4CAF50;
color: white;
border: none;
cursor: pointer;
button:hover {
background-color: #45a049;
#cookieStatus {
margin-top: 20px;
</style>
</head>
<body>
<h2>Cookie Operations</h2>
<script>
function createCookie() {
function deleteCookie() {
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
.navbar {
background-color: #333;
.navbar a {
color: white;
text-decoration: none;
display: inline-block;
.dropdown {
position: relative;
display: inline-block;
.dropdown-content {
display: none;
position: absolute;
background-color: #333;
min-width: 160px;
.dropdown:hover .dropdown-content {
display: block;
.dropdown-content a {
color: white;
text-decoration: none;
display: block;
.dropdown-content a:hover {
background-color: #ddd;
color: black;
</style>
</head>
<body>
<div class="navbar">
<a href="#">Home</a>
<a href="#">About</a>
<!-- Dropdown menu -->
<div class="dropdown">
<a href="#">More</a>
<div class="dropdown-content">
<a href="#">Contact</a>
<a href="#">Blog</a>
<a href="#">Portfolio</a>
</div>
</div>
</div>
</body>
</html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Checkbox Selection</title>
<style>
body {
text-align: center;
padding: 20px;
background-color: #f4f4f4;
button {
margin: 10px;
background-color: #4CAF50;
color: white;
border: none;
cursor: pointer;
#result {
margin-top: 20px;
</style>
</head>
<body>
<div id="result"></div>
<script>
function checkSelection() {
if (document.getElementById('option1').checked) {
if (document.getElementById('option2').checked) {
if (document.getElementById('option3').checked) {
if (result.endsWith(', ')) {
// Show result
document.getElementById('result').textContent = result;
</script>
</body>
</html>
13] WAP to check whether the given string is palindrome is not.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Palindrome Checker</title>
<style>
body {
text-align: center;
padding: 20px;
background-color: #f4f4f4;
input, button {
padding: 10px;
margin: 10px;
#result {
margin-top: 20px;
</style>
</head>
<body>
<div id="result"></div>
<script>
function checkPalindrome() {
} else {
</script>
</body>
</html>