Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
<h2>選取 div 的 B</h2>
<div class="boxs">
  <span>A</span>
  <div>B</div>
  <div>C</div>
  <div>D</div>
  <div>E</div>
</div>
</body>
</html>
 
.boxs {
  width: 520px;
  display:flex;
  flex-flow: row wrap;
}
.boxs > div,span {
  width: 50px;
  height: 50px;
  border: 1px solid #aaa;
  font-size: 30px;
}
/* 錯誤寫法 */
.boxs div:nth-child(1){
  color: #fff;
  background: #25aaff;
}
Output

This bin was created anonymously and its free preview time has expired (learn why). — Get a free unrestricted account

Dismiss x
public
Bin info
anonymouspro
0viewers