|
发表于 2023-5-15 03:14:08
|
显示全部楼层
好的,这是一个简单的登录界面,包括 HTML 和 CSS。
HTML 代码:
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title>登录界面</title>
- <link rel="stylesheet" href="style.css">
- </head>
- <body>
- <div class="login-box">
- <img src="avatar.png" alt="avatar" class="avatar">
- <h1>登录</h1>
- <form>
- <label for="username">用户名</label>
- <input type="text" name="username" placeholder="请输入用户名">
- <label for="password">密码</label>
- <input type="password" name="password" placeholder="请输入密码">
- <input type="submit" value="登录">
- </form>
- </div>
- </body>
- </html>
复制代码
CSS 代码:
- body {
- margin: 0;
- padding: 0;
- background-color: #ccc;
- }
- .login-box {
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- width: 300px;
- padding: 40px;
- background-color: #fff;
- border-radius: 10px;
- box-shadow: 0 0 5px rgba(0,0,0,.3);
- }
- .avatar {
- display: block;
- margin: 0 auto 30px;
- width: 100px;
- height: 100px;
- border-radius: 50%;
- object-fit: cover;
- }
- h1 {
- margin: 0;
- padding: 0 0 20px;
- font-size: 22px;
- text-align: center;
- }
- form label {
- margin: 0;
- padding: 0;
- font-weight: bold;
- display: block;
- }
- form input {
- width: 100%;
- margin-bottom: 20px;
- padding: 10px;
- border-radius: 5px;
- border: none;
- background-color: #f2f2f2;
- font-size: 16px;
- }
- form input[type="submit"] {
- background-color: #008CBA;
- color: #fff;
- cursor: pointer;
- transition: background-color .3s ease-in-out;
- }
- form input[type="submit"]:hover {
- background-color: #006d96;
- }
复制代码
注意,需要将代码中的图片路径和样式文件路径替换为实际路径。 |
|