Build a Book Inventory App - Build a Book Inventory App

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

GitHub Link: freeCodeCamp/curriculum/challenges/english/blocks/lab-book-inventory-app/66a207974c806a19d6607073.md at main · freeCodeCamp/freeCodeCamp · GitHub

Hi @SimbaBrynMahaja,

Please get your HTML corrected first.

User stories #6 and 7 say:

  1. td elements of the Rate column should contain a span element with the class of rate wrapping three empty span elements.
  2. .rate elements placed inside .read rows should have an additional class with the value of either one, two, or three, depending on the personal rate. This value should come after rate.

Do you have an additional class of one, two or three for only .read rows?
Should the span elements wrapped in the .rate span contain a class attribute?

Happy coding

Read
    <td><span class="rate three">

      <span></span>

      <span></span>

      <span></span></span></td>

Yes and yes to the above questions, however, targeting the first two descendants of the span element seems like an unheard melody. Although, this; span[class~=“two”] > :nth-child(2) {

background-image: linear-gradient(to top, #4ee6ff, brown);

}

does seem to target the span with a word two as class, it is still not the required code. How to target the first two descendants is where I am vexed.

what child is this targeting? there are many ways to add the other child here, can you think of at least one?

Got it. I’m taking note of my errors, just. Thanks again