Skip to content

Instantly share code, notes, and snippets.

@amalik-poit
Created October 18, 2025 04:06
Show Gist options
  • Select an option

  • Save amalik-poit/863b090707db0360f92aeff89c9e123c to your computer and use it in GitHub Desktop.

Select an option

Save amalik-poit/863b090707db0360f92aeff89c9e123c to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML5 & CSS3 Animation Example</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f0f8ff;
text-align: center;
}
header {
background-color: #0078d7;
color: white;
padding: 20px;
animation: fadeIn 2s;
}
nav {
background-color: #333;
padding: 10px 0;
}
nav a {
color: white;
text-decoration: none;
padding: 10px 20px;
display: inline-block;
}
nav a:hover {
background-color: #0078d7;
}
main {
padding: 20px;
}
section {
margin: 20px auto;
max-width: 600px;
background: white;
border-radius: 10px;
padding: 20px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
animation: slideIn 1.5s ease-out;
}
h1, h2 {
margin-bottom: 10px;
}
.blink {
color: red;
font-weight: bold;
animation: blink 1s infinite;
}
@keyframes blink {
0%, 50%, 100% { opacity: 1; }
25%, 75% { opacity: 0; }
}
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
@keyframes slideIn {
from { transform: translateY(30px); opacity: 0; }
to { transform: translateY(0); opacity: 1; }
}
footer {
background-color: #0078d7;
color: white;
padding: 10px;
margin-top: 30px;
}
button {
background-color: #0078d7;
color: white;
border: none;
padding: 10px 15px;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s;
}
button:hover {
background-color: #005fa3;
}
.move-box {
width: 100px;
height: 100px;
background-color: orange;
margin: 20px auto;
border-radius: 10px;
animation: moveAround 4s infinite alternate;
}
@keyframes moveAround {
0% { transform: translateX(0); }
50% { transform: translateX(100px); }
100% { transform: translateX(0); }
}
</style>
</head>
<body>
<header>
<h1>Welcome to HTML5 & CSS3 Demo</h1>
<p>Learn web animations the fun way!</p>
</header>
<nav>
<a href="#home">Home</a>
<a href="#about">About</a>
<a href="#contact">Contact</a>
</nav>
<main>
<section id="home">
<h2>What is HTML5?</h2>
<p>HTML5 is the latest version of HyperText Markup Language used to structure web pages.</p>
<p class="blink">This text is blinking!</p>
</section>
<section id="about">
<h2>What is CSS3?</h2>
<p>CSS3 adds style, colors, animations, and layouts to make web pages look beautiful.</p>
<div class="move-box"></div>
</section>
<section id="contact">
<h2>Try an Interactive Button</h2>
<p>Click below to change the background color!</p>
<button onclick="changeColor()">Change Background</button>
</section>
</main>
<footer>
<p>&copy; 2025 HTML & CSS Learning Demo</p>
</footer>
<script>
function changeColor() {
const colors = ["#f0f8ff", "#fff3cd", "#e6ffe6", "#ffe6f2"];
document.body.style.backgroundColor = colors[Math.floor(Math.random() * colors.length)];
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment