给我写一个好看的网站的登陆界面
时间: 2024-03-25 22:38:41 浏览: 17
好的,以下是一个简单但美观的网站登陆界面的示例代码:
```html
<!DOCTYPE html>
<html>
<head>
<title>登陆界面</title>
<link rel="stylesheet" type="text/css" href="style.css"> <!-- 引入CSS文件 -->
</head>
<body>
<div class="container">
<h1>欢迎来到我们的网站</h1>
<form>
<label for="username">用户名:</label>
<input type="text" id="username" name="username" required>
<label for="password">密码:</label>
<input type="password" id="password" name="password" required>
<input type="submit" value="登陆">
</form>
</div>
</body>
</html>
```
同时,为了让登陆界面更加美观,可以在同一目录下创建一个名为 `style.css` 的 CSS 文件,并添加以下代码:
```css
* {
box-sizing: border-box;
}
body {
background-color: #f1f1f1;
font-family: Arial, sans-serif;
}
.container {
background-color: #fff;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
margin: 100px auto;
padding: 20px;
text-align: center;
width: 400px;
}
h1 {
color: #333;
margin-bottom: 30px;
}
form {
display: inline-block;
text-align: left;
width: 100%;
}
label {
display: block;
margin-bottom: 10px;
}
input[type=text], input[type=password] {
border: none;
border-radius: 5px;
box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
padding: 10px;
width: 100%;
}
input[type=submit] {
background-color: #4CAF50;
border: none;
border-radius: 5px;
color: white;
cursor: pointer;
margin-top: 20px;
padding: 10px;
width: 100%;
}
input[type=submit]:hover {
background-color: #3e8e41;
}
```
这些代码将创建一个白色的容器,包含一个标题、一个表单和一个提交按钮。表单包含两个输入框(一个用于用户名,一个用于密码),并使用 CSS 样式使其看起来更加美观。