<!DOCTYPE html>
<html>
<head>
<title>MySQL登录界面</title>
<style>
.login-container {
width: 400px;
margin: 0 auto;
}
.form-group {
margin-bottom: 20px;
}
.form-group label {
display: block;
}
.form-group input {
width: 100%;
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
}
.btn {
padding: 10px 20px;
border: none;
border-radius: 5px;
background-color: #007bff;
color: #fff;
cursor: pointer;
}
</style>
</head>
<body>
<div class="login-container">
<h1>MySQL登录</h1>
<form method="post">
<div class="form-group">
<label>用户名</label>
<input type="text" name="username" required>
</div>
<div class="form-group">
<label>密码</label>
<input type="password" name="password" required>
</div>
<button type="submit" class="btn">登录</button>
</form>
</div>
</body>
</html>
上面的示例代码中,大家首先定义了一个宽度为400px,居中显示的登录容器,然后分别定义了表单元素以及提交按钮的样式。在HTML部分,大家使用form标签定义表单,分别有用户名和密码两个输入框,以及一个提交按钮。在PHP部分,大家可以使用mysqli或PDO等API进行登录验证和数据查询。