Tell us what’s happening:
‘You should have an attribute selector to target the first two descendants of span elements that have the word two as a part of their class value’. I am currently vexed on how to target the first two descendants. Can someone advice?
Your code so far
<!-- file: index.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Book Inventory</title>
<link rel="stylesheet" href="styles.css">
</head>
<h1>Book Inventory</h1>
<body>
<table>
<thead>
<tr>
<th>Title</th>
<th>Author</th>
<th>Category</th>
<th>Status</th>
<th>Rate</th>
</tr>
</thead>
<tbody>
<tr class="read">
<td>The Idiot Brain</td>
<td>Dean Burnett</td>
<td>Psychology</td>
<td><span class="status">Read</span></td>
<td><span class="rate three">
<span class="one"></span>
<span class="two"></span>
<span class="three"></span></span></td>
</tr>
<tr class="to-read">
<td>The Psychology of Money</td>
<td>Morgan Housel</td>
<td>Finance</td>
<td><span class="status">To Read</span></td>
<td><span class="rate two">
<span class="one"></span>
<span class="two"></span>
<span class="three"></span></span></td>
</tr>
<tr class="in-progress">
<td>Think Again</td>
<td>Adam Grant</td>
<td>Psychology</td>
<td><span class="status">In Progress</span></td>
<td><span class="rate three">
<span class="one"></span>
<span class="two"></span>
<span class="three"></span></span></td>
</tr>
</tbody>
</table>
</body>
</html>
/* file: styles.css */
h1 {
font-family: Georgia, sans serif;
text-align: center;
padding: 30px;
}
table {
width: 200px;
height: 200px;
margin: 0 auto;
padding: 40px;
}
tr[class="read"] {
background-image: linear-gradient(to bottom, #4f6f4f, white);
margin: 10px;
padding: 10px;
}
tr[class="to-read"] {
background-image: linear-gradient(to bottom, teal, pink);
margin: 10px;
}
tr[class="in-progress"] {
background-image: linear-gradient(to top, blue, skyblue);
height: 20px;
width: 30px;
margin: 10px;
}
span {
display: inline-block;
}
tr[class="to-read"] span[class="status"] {
border: 30px;
background-image: linear-gradient(to right,#ff3ff3, #f0000f);
}
tr[class="read"] span[class="status"] {
border: 30px;
background-image: linear-gradient(to left, brown, pink);
}
tr[class="in-progress"] span[class="status"] {
border: 30px;
background-image: linear-gradient(to right, cyan, skyblue);
}
span[class="status"], span[class^="rate"] {
height: 20px;
width: 30px;
padding: 20px;
}
span[class^="rate"] > span {
border: 20px;
border-radius: 20px;
margin: 20px;
height: 30px;
width: 30px;
background-color: purple;
}
span[class~="one"] span:first-child {
background-image: linear-gradient(to bottom, #33ff22, yellow);
}
span[class*="two"] :nth-child(2) {
background-image: linear-gradient(to top, #4ee6ff, brown);
}
span[class~="three"] :nth-child {
background-image: linear-gradient(to bottom, green, white);
}
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/156.0.0.0 Safari/537.36 Edg/156.0.0.0
Challenge Information:
Build a Book Inventory App - Build a Book Inventory App