动态交互登录界面html 要求有动画
时间: 2023-08-15 14:05:49 浏览: 60
以下是一个简单的动态交互登录界面 HTML 示例,其中包括动画效果:
```html
<!DOCTYPE html>
<html>
<head>
<title>Login Form</title>
<style>
body {
background-color: #f2f2f2;
font-family: Arial, sans-serif;
}
.container {
margin: 100px auto;
width: 400px;
background-color: #fff;
padding: 25px;
box-shadow: 0 0 10px rgba(0,0,0,0.3);
}
h2 {
text-align: center;
margin-bottom: 25px;
color: #444;
}
input[type="text"], input[type="password"] {
width: 100%;
padding: 12px 20px;
margin: 8px 0;
box-sizing: border-box;
border: none;
border-bottom: 2px solid #ccc;
background-color: #f8f8f8;
font-size: 16px;
color: #444;
}
input[type="submit"] {
background-color: #4caf50;
color: #fff;
padding: 12px 20px;
margin: 8px 0;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
transition: background-color 0.3s ease;
}
input[type="submit"]:hover {
background-color: #3e8e41;
}
@keyframes slidein {
from {
transform: translateY(-100%);
}
to {
transform: translateY(0%);
}
}
@keyframes fadein {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
.form-group {
animation: slidein 0.5s forwards;
opacity: 0;
animation-delay: 0.4s;
}
h2 {
animation: fadein 0.5s forwards;
opacity: 0;
animation-delay: 0.2s;
}
</style>
</head>
<body>
<div class="container">
<form>
<h2>Login Form</h2>
<div class="form-group">
<label for="username">Username:</label>
<input type="text" id="username" name="username" required>
</div>
<div class="form-group">
<label for="password">Password:</label>
<input type="password" id="password" name="password" required>
</div>
<input type="submit" value="Login">
</form>
</div>
</body>
</html>
```
这个登录界面包括一个使用 CSS 动画效果的表单组件,使表单在页面加载时从顶部滑入,并在页面加载时淡入。通过在 CSS 中使用 `@keyframes` 规则和 `animation` 属性,可以轻松实现这种动画效果。