Build a Book Inventory App - Build a Book Inventory App

Tell us what’s happening:

I’m sure my code has no errors, but I don’t know why it doesn’t work. I’ve tried everything.

Your code so far

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Book Inventory</title>
    <link rel="stylesheet" href="styles.css">
</head>
<body>

    <h1>Book Inventory</h1>

    <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 Great Gatsby</td>
                <td>F. Scott Fitzgerald</td>
                <td>Fiction</td>
                <td><span class="status">Read</span></td>
                <td>
                    <span class="rate three">
                        <span></span>
                        <span></span>
                        <span></span>
                    </span>
                </td>
            </tr>
            <tr class="in-progress">
                <td>Atomic Habits</td>
                <td>James Clear</td>
                <td>Self-Help</td>
                <td><span class="status">In Progress</span></td>
                <td>
                    <span class="rate">
                        <span></span>
                        <span></span>
                        <span></span>
                    </span>
                </td>
            </tr>
            <tr class="to-read">
                <td>Dune</td>
                <td>Frank Herbert</td>
                <td>Sci-Fi</td>
                <td><span class="status">To Read</span></td>
                <td>
                    <span class="rate">
                        <span></span>
                        <span></span>
                        <span></span>
                    </span>
                </td>
            </tr>
            <tr class="read">
                <td>To Kill a Mockingbird</td>
                <td>Harper Lee</td>
                <td>Fiction</td>
                <td><span class="status">Read</span></td>
                <td>
                    <span class="rate one">
                        <span></span>
                        <span></span>
                        <span></span>
                    </span>
                </td>
            </tr>
        </tbody>
    </table>

</body>
</html>
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f7f6;
    color: #333;
    padding: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background-color: #fff;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background-color: #35495e;
    color: #ffffff;
}

span {
    display: inline-block;
}

tr[class="read"] {
    background-image: linear-gradient(to right, #ffffff, #e8f5e9);
}

tr[class="to-read"] {
    background-image: linear-gradient(to right, #ffffff, #ffe0b2);
}

tr[class="in-progress"] {
    background-image: linear-gradient(to right, #ffffff, #e3f2fd);
}

tr[class="to-read"] span[class="status"] {
    border: 2px solid #f57c00;
    background-image: linear-gradient(#ffe0b2, #ffb74d);
}

tr[class="read"] span[class="status"] {
    border: 2px solid #388e3c;
    background-image: linear-gradient(#e8f5e9, #81c784);
}

tr[class="in-progress"] span[class="status"] {
    border: 2px solid #1976d2;
    background-image: linear-gradient(#e3f2fd, #64b5f6);
}

span[class="status"], span[class^="rate"] {
    height: 25px;
    width: auto;
    padding: 5px 10px;
}

span[class^="rate"] > span {
    border: 1px solid #757575;
    border-radius: 50%;
    margin: 0 2px;
    height: 15px;
    width: 15px;
    background-color: #e0e0e0;
}

span[class~="one"] span:nth-of-type(1) {
    background-image: linear-gradient(#fbc02d, #f9a825);
}

span[class~="two"] span:nth-of-type(1), span[class~="two"] span:nth-of-type(2) {
    background-image: linear-gradient(#fbc02d, #f9a825);
}

span[class~="three"] span {
    background-image: linear-gradient(#fbc02d, #f9a825);
}

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36

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

I would argue that nth-of-type does not necessarily target the nth descendant, can you think of a different approach? something that targets based on being the first descendant, not the first descendant of a certain type