netbeans编写css登录页面
时间: 2023-07-26 13:46:23 浏览: 53
以下是使用 NetBeans 编写 CSS 登录页面的示例代码:
HTML 代码:
```html
<!DOCTYPE html>
<html>
<head>
<title>Login Page</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="login-box">
<h2>Login Here</h2>
<form>
<p>Username</p>
<input type="text" name="" placeholder="Enter Username">
<p>Password</p>
<input type="password" name="" placeholder="Enter Password">
<input type="submit" name="" value="Login">
<a href="#">Forgot Password</a>
</form>
</div>
</body>
</html>
```
CSS 代码:
```css
body {
margin: 0;
padding: 0;
background: #f2f2f2;
}
.login-box {
width: 320px;
height: 420px;
background: #fff;
color: #000;
top: 50%;
left: 50%;
position: absolute;
transform: translate(-50%, -50%);
box-sizing: border-box;
padding: 70px 30px;
}
h2 {
margin: 0;
padding: 0 0 20px;
text-align: center;
font-size: 22px;
}
.login-box p {
margin: 0;
padding: 0;
font-weight: bold;
}
.login-box input {
width: 100%;
margin-bottom: 20px;
}
.login-box input[type="text"],
.login-box input[type="password"] {
border: none;
border-bottom: 1px solid #000;
background: transparent;
outline: none;
height: 40px;
color: #000;
font-size: 16px;
}
.login-box input[type="submit"] {
border: none;
outline: none;
height: 40px;
background: #000;
color: #fff;
font-size: 18px;
border-radius: 20px;
}
.login-box input[type="submit"]:hover {
cursor: pointer;
background: #ffc107;
color: #000;
}
.login-box a {
text-decoration: none;
font-size: 14px;
line-height: 20px;
color: darkgrey;
}
.login-box a:hover {
color: #ffc107;
}
```
将以上两个代码复制到 NetBeans 中,然后保存为 `index.html` 和 `style.css`。然后在浏览器中打开 `index.html` 文件,你就可以看到一个简单的 CSS 登录页面了。
希望这个示例可以帮助你开始在 NetBeans 中编写 CSS 代码!