制作一个用户注册表单
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<h3>用户注册界面</h3>
<form action="1.php" method="GET"></form>
<div>
<label for="name">账号:</label>
<input type="text" name="name" id="name" autofocus required />
</div>
<div>
<label>密码:</label>
<input type="password" name="paw" id="paw" required />
</div>
<div>
<label for="fruit">水果:</label>
<input type="radio" name="" id="fruit" /><label>葡萄</label>
<input type="radio" name="" id="" /><label>香蕉</label>
<input type="radio" name="" id="" /><label>菠萝</label>
</div>
<div>
<label for="fru">水果:</label>
<input type="checkbox" name="" id="" /><label>葡萄</label>
<input type="checkbox" name="" id="" /><label>香蕉</label>
<input type="checkbox" name="" id="fru" /><label>菠萝</label>
</div>
<div>
<select name="" id="">
<option value="1">葡萄</option>
<option value="2" selected>香蕉</option>
<option value="3">菠萝</option>
</select>
</div>
<button>提交</button>
</body>
</html>
基本选择器
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=u, initial-scale=1.0" />
<title>Document</title>
<style>
ol {
background-color: rebeccapurple;
}
li#apple {
background-color: rosybrown;
}
li.banana {
background-color: black;
}
li[id="pt"] {
background-color: chartreuse;
}
</style>
</head>
<body>
<ol>
<li id="apple">苹果</li>
<li class="banana">香蕉</li>
<li id="pt">葡萄</li>
<li>菠菜</li>
<li>西瓜</li>
</ol>
</body>
</html>
上下文选择器
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=u, initial-scale=1.0" />
<title>Document</title>
<style>
ol li {
background-color: chartreuse;
}
body > ol > li {
background-color: chocolate;
}
#xg + li {
background-color: cornflowerblue;
}
#bc ~ li {
background-color: cyan;
}
</style>
</head>
<body>
<ol>
<li>苹果</li>
<li id="xg">香蕉</li>
<li>葡萄</li>
<ol>
<li id="bc">菠菜</li>
<li>西瓜</li>
<li>菠菜</li>
</ol>
<li>菠菜</li>
<li>西瓜</li>
</ol>
</body>
</html>