来个登录界面的源码
这是一个简单的HTML和CSS登录界面的源码示例:
HTML代码:
<!DOCTYPE html>
<html>
<head>
<title>登录页面</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="login-box">
<h2>登录</h2>
<form>
<div class="user-box">
<input type="text" name="username" required="">
<label>用户名</label>
</div>
<div class="user-box">
<input type="password" name="password" required="">
<label>密码</label>
</div>
<input type="submit" name="submit" value="登录">
</form>
</div>
</body>
</html>
CSS代码:
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: sans-serif;
}
body {
background-color: #f1f1f1;
}
.login-box {
width: 320px;
height: 420px;
background-color: #fff;
color: #000;
top: 50%;
left: 50%;
position: absolute;
transform: translate(-50%, -50%);
box-shadow: 0px 5px 25px rgba(0, 0, 0, 0.1);
padding: 70px 30px;
border-radius: 10px;
}
h2 {
margin: 0;
padding: 0 0 20px;
text-align: center;
font-size: 22px;
}
.login-box form {
display: flex;
flex-direction: column;
}
.login-box form .user-box {
position: relative;
}
.login-box form .user-box input {
width: 100%;
padding: 10px 0;
font-size: 16px;
color: #000;
margin-bottom: 30px;
border: none;
border-bottom: 1px solid #000;
outline: none;
background: transparent;
}
.login-box form .user-box label {
position: absolute;
top: 0;
left: 0;
padding: 10px 0;
font-size: 16px;
color: #000;
pointer-events: none;
transition: 0.5s;
}
.login-box form .user-box input:focus ~ label,
.login-box form .user-box input:valid ~ label {
top: -20px;
left: 0;
color: #000;
font-size: 12px;
}
.login-box input[type="submit"] {
background-color: #000;
color: #fff;
border: none;
padding: 10px 20px;
border-radius: 20px;
cursor: pointer;
}
.login-box input[type="submit"]:hover {
background-color: #fff;
color: #000;
}
这个登录界面是一个简单的HTML表单,包括用户名和密码输入框以及一个登录按钮。CSS样式定义了表单的布局和样式,包括输入框的动态标签效果和按钮的悬停效果
原文地址: http://www.cveoy.top/t/topic/enpV 著作权归作者所有。请勿转载和采集!