由于过于生疏还不太理解,写的不好,请老师谅解!
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>表单css</title>
<style>
/* 样式初始化 reset.css */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
a {
color: #555;
text-decoration: none;
}
/* 基本选择器 */
body{
background-color: rgb(0, 162, 255);
}
/* 上下文选择器 */
em + li {
background-color: blueviolet;
}
</style>
</head>
<body>
<!-- 标题 -->
<h3 align="center">用户登陆</h3>
<form action="">
<!-- 表单分组 -->
<fieldset align="center" >
<ul>
<li>
<div>
<div>
<label for="username">帐号:</label>
<input
type="text"
id="username"
name="username"
autofocus
required
placeholder="登陆账户"
value="username"
/>
</div>
</div>
</li>
<li>
<div>
<label for="psw">密码:</label>
<input type="password" id="psw" name="psw" required placeholder="不少于6位" />
<!-- <button type="button" onclick="document.querySelector('#psw').type='text'">显示密码</button> -->
</div>
</li>
<li class="em">
<div>
<div>
<label for="email">邮箱:</label>
<input type="email" id="email" name="email" required placeholder="deml@email.com" class="em"/>
</div>
</div>
</li>
<li >
<button>登陆</button>
</li>
</ul>
</fieldset>
</form>
</body>
</html>
显示效果