设计一个登录界面html代码美观一点的
时间: 2023-08-12 11:06:09 浏览: 52
好的,下面是一个简单的登录界面的HTML代码,采用了一些CSS样式,让界面看起来更美观:
```html
<!DOCTYPE html>
<html>
<head>
<title>Login Page</title>
<style>
body {
background-color: #f2f2f2;
font-family: Arial, sans-serif;
}
.container {
margin: auto;
width: 300px;
padding: 20px;
background-color: #fff;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0,0,0,0.2);
}
h1 {
text-align: center;
margin-bottom: 30px;
color: #333;
}
input[type=text], input[type=password] {
width: 100%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
button {
background-color: #4CAF50;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
border-radius: 4px;
cursor: pointer;
width: 100%;
}
button:hover {
background-color: #45a049;
}
.cancelbtn {
background-color: #f44336;
}
.imgcontainer {
text-align: center;
margin: 24px 0 12px 0;
}
img.avatar {
width: 30%;
border-radius: 50%;
}
.container label {
float: left;
color: #666;
}
.forgot {
float: right;
color: #666;
}
.clearfix::after {
content: "";
clear: both;
display: table;
}
</style>
</head>
<body>
<div class="container">
<h1>Login</h1>
<div class="imgcontainer">
<img src="avatar.png" alt="Avatar" class="avatar">
</div>
<form action="/action_page.php">
<div class="container">
<label for="uname"><b>Username</b></label>
<input type="text" placeholder="Enter Username" name="uname" required>
<label for="psw"><b>Password</b></label>
<input type="password" placeholder="Enter Password" name="psw" required>
<button type="submit">Login</button>
<label>
<input type="checkbox" checked="checked" name="remember"> Remember me
</label>
</div>
<div class="clearfix">
<a href="#" class="forgot">Forgot password?</a>
</div>
</form>
</div>
</body>
</html>
```
您可以将上述代码保存为一个HTML文件,然后使用浏览器打开查看效果。如果需要更改样式,可以修改代码中的CSS部分。