帮我用HTML、CSS写一个字体可爱的磨砂玻璃质感登陆页面
时间: 2023-10-23 09:08:43 浏览: 41
好的,下面是一个简单的可爱磨砂玻璃质感登录页面的HTML和CSS代码:
HTML代码:
```html
<!DOCTYPE html>
<html>
<head>
<title>可爱磨砂玻璃质感登录页面</title>
<link href="https://fonts.googleapis.com/css?family=Poppins:400,700&display=swap" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="login-box">
<h1>Login</h1>
<div class="textbox">
<input type="text" placeholder="Username" name="" value="">
</div>
<div class="textbox">
<input type="password" placeholder="Password" name="" value="">
</div>
<input class="btn" type="button" name="" value="Sign In">
</div>
</body>
</html>
```
CSS代码:
```css
body {
margin: 0;
padding: 0;
background: url(bg.jpg) no-repeat center center fixed;
background-size: cover;
font-family: 'Poppins', sans-serif;
}
.login-box {
width: 320px;
height: 420px;
background: rgba(0, 0, 0, 0.5);
color: #fff;
top: 50%;
left: 50%;
position: absolute;
transform: translate(-50%, -50%);
box-sizing: border-box;
padding: 70px 30px;
}
.textbox {
width: 100%;
overflow: hidden;
font-size: 20px;
padding: 8px 0;
margin: 8px 0;
border-bottom: 1px solid #fff;
}
.textbox input {
border: none;
outline: none;
background: none;
color: #fff;
font-size: 18px;
width: 80%;
float: left;
margin: 0 10px;
}
.btn {
width: 100%;
background: none;
border: 2px solid #fff;
color: #fff;
padding: 5px;
font-size: 18px;
cursor: pointer;
margin: 12px 0;
}
.btn:hover {
background-color: #fff;
color: #000;
transition: 0.5s;
}
h1 {
margin: 0;
padding: 0 0 20px;
text-align: center;
font-size: 30px;
}
```
其中,bg.jpg是作为背景图的图片,可以替换为自己喜欢的图片。另外,使用了Google Fonts中的Poppins字体,可以根据需要替换其他字体。