<!DOCTYPE html><html> <head> <meta charset="UTF-8"> <title></title> <style type="text/css"> /*標簽名查找,名稱相同,格式相同*/ span{ color: coral; } /*id名查找,名稱不可重覆*/ ...
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
/*標簽名查找,名稱相同,格式相同*/
span{
color: coral;
}
/*id名查找,名稱不可重覆*/
#a{
width: 100px;
height: 100px;
background-color: #5F9EA0;
}
/*class查找,名稱可重覆,格式相同*/
.b{
width: 100px;
height: 100px;
background-color: #8A2BE2;
border: 1px solid green;
}
/*併列用“ ,”格式相同*/
#c,.d{
width: 100px;
height: 100px;
background-color: #FF0000;
border: 1px solid green;
}
/*父級,子級用空格*/
#fu #zi1,#zi2{
width: 100px;
height: 100px;
background-color: black;
border: 1px solid green;
}
</style>
</head>
<body>
<span >
標簽名查找
</span>
<div id="a"></div>
<div class="b"></div>
<div class="b"></div>
<div id="c"></div>
<div class="d"></div>
<div id="fu">
<div id="zi1"></div>
<div id="zi2"></div>
</div>
</body>
</html>