用css和HTML生成炫酷的登录页,并给出代码
时间: 2023-03-07 10:36:53 浏览: 64
使用 CSS 和 HTML 生成炫酷的登录页很容易。以下是一个示例代码:<!DOCTYPE html>
<html>
<head>
<title>登录页</title>
<style type="text/css">
body {
background-color: #f1f1f1;
}
.box {
width: 400px;
padding: 40px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: #fff;
box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.2), 0 5px 5px 0 rgba(0, 0, 0, 0.24);
}
input {
width: 100%;
margin-bottom: 20px;
}
input[type="text"], input[type="password"] {
border: none;
border-bottom: 1px solid #000000;
background: transparent;
outline: none;
height: 40px;
}
input[type="submit"] {
border: none;
outline: none;
background: #FF0000;
color: #fff;
font-size: 18px;
border-radius: 20px;
}
input[type="submit"]:hover {
cursor: pointer;
background: #ff7f50;
color: #000;
}
</style>
</head>
<body>
<div class="box">
<h1>登录</h1>
<form>
<input type="text" name="username" placeholder="用户名">
<input type="password" name="password" placeholder="密码">
<input type="submit" value="登录">
</form>
</div>
</body>
</html>