html炫酷登录页源码
时间: 2023-12-30 12:00:38 浏览: 34
HTML炫酷登录页源码可以通过使用HTML、CSS和JavaScript来实现。首先,在HTML中创建一个登录页的基本结构,包括输入框、按钮等元素,并且设置好各个元素的id和class属性。然后,在CSS中对页面进行样式美化,可以使用动画、渐变色等效果来增加页面的炫酷性。最后,在JavaScript中添加一些交互功能,例如输入框验证、按钮点击事件等,以及一些特效,比如弹出框提示、背景动画等。
下面是一个简单的HTML炫酷登录页源码示例:
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>Cool Login Page</title>
</head>
<body>
<div class="container">
<form id="login-form">
<h2>Welcome Back! Please Login</h2>
<input type="text" id="username" placeholder="Username">
<input type="password" id="password" placeholder="Password">
<button type="submit">Login</button>
</form>
</div>
<script src="script.js"></script>
</body>
</html>
```
```css
body {
margin: 0;
padding: 0;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
background: linear-gradient(45deg, #FF6B6A, #5A37FF);
}
.container {
text-align: center;
background: #fff;
padding: 30px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
input {
width: 100%;
padding: 10px;
margin: 10px 0;
border: 1px solid #ccc;
border-radius: 5px;
}
button {
width: 100%;
padding: 10px;
margin: 10px 0;
border: none;
border-radius: 5px;
background: #FF6B6A;
color: white;
cursor: pointer;
transition: background 0.3s;
}
button:hover {
background: #5A37FF;
}
h2 {
color: #5A37FF;
}
```
```javascript
document.getElementById('login-form').addEventListener('submit', function(e) {
e.preventDefault();
const username = document.getElementById('username').value;
const password = document.getElementById('password').value;
// add login logic here
});
```
通过以上的HTML、CSS和JavaScript代码,我们可以创建一个简单的炫酷登录页,当用户在输入框输入用户名和密码后,点击登录按钮即可实现登录功能。同时,页面的样式和交互效果也会让用户感到非常炫酷和舒适。