English
Deutsch
Français
Italiano
Español
HTML
Скопировать HTML
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>CSS Animation fadeIn</title> </head> <body> <div class="element">Hello, world!</div> <button class="refresh-btn" onclick="location.reload();">Refresh the page</button> </body> </html>
CSS
Скопировать CSS
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } } .element { width: 200px; height: 100px; background-color: #3498db; color: white; display: flex; justify-content: center; align-items: center; font-size: 20px; border-radius: 10px; animation-name: fadeIn; animation-duration: 2s; animation-timing-function: ease-in-out; animation-fill-mode: forwards; margin-bottom: 20px; } .refresh-btn { padding: 10px 20px; font-size: 16px; background-color: #2ecc71; color: white; border: none; border-radius: 5px; cursor: pointer; } .refresh-btn:hover { background-color: #27ae60; }
JavaScript
Скопировать JS
Результат
Скачать файлом