<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Image Flip Example</title>
<style>
.image-container {
text-align: center; /* Center align content */
margin-top: 50px; /* Margin at the top */
}
#flipButton {
padding: 10px 20px; /* Padding around the text */
font-size: 16px; /* Text size */
cursor: pointer; /* Cursor appears as a pointer */
background-color: #4CAF50; /* Background color */
color: white; /* Text color */
border: none; /* No border */
border-radius: 5px; /* Rounded corners */
}
#imageCaption {
font-size: 18px;
color: #333;
margin-top: 10px;
}
</style>
</head>
<body>
<div class="image-container">
<img id="imageToFlip" src="kitten.jpg" alt="Kitten Image" width="200">
<br>
<button id="flipButton" onclick="flipImage()">Flip Image</button>
<h3 id="imageCaption">Your Wife before the Wedding</h3>
</div>
<script>
function flipImage() {
var image = document.getElementById('imageToFlip');
var caption = document.getElementById('imageCaption');
if (image.src.includes('kitten.jpg')) {
image.src = 'tiger.jpg';
caption.innerHTML = 'Your Wife after the Wedding';
} else {
image.src = 'kitten.jpg';
caption.innerHTML = 'Your Wife before the Wedding';
}
}
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Image Flip Example</title>
<style>
/* Using class selector for styling the container */
.image-container {
text-align: center; /* Center align content */
margin-top: 50px; /* Margin at the top */
}
/* Using ID selector for styling the button */
#flipButton {
padding: 10px 20px; /* Padding around the text */
font-size: 16px; /* Text size */
cursor: pointer; /* Cursor appears as a pointer */
background-color: #4CAF50; /* Background color */
color: white; /* Text color */
border: none; /* No border */
border-radius: 5px; /* Rounded corners */
}
</style>
</head>
<body>
<div class="image-container">
<img id="imageToFlip" src="kitten.jpg" alt="Kitten Image" width="200">
<br>
<button id="flipButton" onclick="flipImage()">Flip Image</button>
</div>
<script>
function flipImage() {
var image = document.getElementById('imageToFlip');
// Use local filenames for comparison
if (image.src.includes('kitten.jpg')) {
image.src = 'tiger.jpg'; // Switch to the second local image
} else {
image.src = 'kitten.jpg'; // Switch back to the original local image
}
}
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dynamic Theme Example</title>
<style id="dynamicStyle">
body {
transition: background-color 0.5s ease-in-out, color 0.5s ease-in-out;
}
/* Default style for the kitten (warm and inviting) */
.warm {
background-color: #FFDAB9; /* peach color */
color: #6A5ACD; /* slate blue */
}
/* Style for the tiger (scary and terrifying) */
.terrifying {
background-color: #2F4F4F; /* dark slate gray */
color: #DC143C; /* crimson for a scary effect */
}
.image-container {
text-align: center; /* Center align content */
margin-top: 50px; /* Margin at the top */
}
#flipButton {
padding: 10px 20px; /* Padding around the text */
font-size: 16px; /* Text size */
cursor: pointer; /* Cursor appears as a pointer */
border: none; /* No border */
border-radius: 5px; /* Rounded corners */
transition: background-color 0.5s ease-in-out;
}
/* Default button style */