Build an Availability Table - Build an Availability Table

Tell us what’s happening:

I can’t pass steps 4, 10, 34 and 35 of Build an Availability Table. I searched the forum but I couldn’t find anything that helped me to solve my problems.

Your code so far

<!-- file: index.html -->
<!DOCTYPE html>
<html lang="en">

<head>
    <link rel="stylesheet" href="styles.css">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Availability Table</title>
</head>

<body>
    <table>
        <tbody>
            <tr class="sharp">
                <th class="hidden">Time</th>
                <th>Monday</th>
                <th>Tuesday</th>
                <th>Wednesday</th>
                <th>Thursday</th>
                <th>Friday</th>
            </tr>
            <tr class="half row-1">
                <th class="time">9 AM</th>
                <td class="available-0"></td>
                <td class="available-5"></td>
                <td class="available-1"></td>
                <td class="available-3"></td>
                <td class="available-4"></td>
            </tr>
            <tr class="sharp">
                <th class="time hidden">blank</th>
                <td class="available-5"></td>
                <td class="available-4"></td>
                <td class="available-0"></td>
                <td class="available-2"></td>
                <td class="available-3"></td>
            </tr>
            <tr class="half">
                <th class="time">10 AM</th>
                <td class="available-3"></td>
                <td class="available-4"></td>
                <td class="available-1"></td>
                <td class="available-0"></td>
                <td class="available-5"></td>
            </tr>
            <tr class="sharp">
                <th class="time hidden">blank</th>
                <td class="available-0"></td>
                <td class="available-3"></td>
                <td class="available-5"></td>
                <td class="available-1"></td>
                <td class="available-2"></td>
            </tr>
            <tr class="half">
                <th class="time">11 AM</th>
                <td class="available-3"></td>
                <td class="available-1"></td>
                <td class="available-5"></td>
                <td class="available-2"></td>
                <td class="available-4"></td>
            </tr>
            <tr class="sharp">
                <th class="time hidden">blank</th>
                <td class="available-2"></td>
                <td class="available-0"></td>
                <td class="available-1"></td>
                <td class="available-4"></td>
                <td class="available-3"></td>
            </tr>
            <tr>
                <th class="time">12 PM</th>
            </tr>
        </tbody>
    </table>
    <div id="legend">
        <span>Availability</span>
        <div id="legend-gradient"></div>
    </div>
</body>

</html>

/* file: styles.css */
:root {
  --color0: #fff;
  --color1: #fcc;
  --color2: #faa;
  --color3: #f77;
  --color4: #f44;
  --color5: #f11;
  --solid-border: 1px solid black;
  --dashed-border: 1px dashed black;
}

body {
  background-color: #700;
  color: white;
}

table {
  border-collapse: collapse;
  margin: 0 auto;
  width: 80%;
  table-layout: fixed;
  word-wrap: break-word;
}

.available-0 {
  background-color: var(--color0);
}

.available-1 {
  background-color: var(--color1);
}

.available-2 {
  background-color: var(--color2);
}

.available-3 {
  background-color: var(--color3);
}

.available-4 {
  background-color: var(--color4);
}

.available-5 {
  background-color: var(--color5);
}

.hidden {
  visibility: hidden;
}

.sharp td {
  border-bottom: var(--solid-border);
}

.half td {
  border-bottom: var(--dashed-border);
}

tbody > tr > th {
  position: relative;
  top: -10px;
}

td {
  border-left: 1px solid black;
  border-right: 1px solid black;
}

.row-1 > td {
  border-top: 1px solid black;
}

#legend {
  margin: 20px auto;
  display: flex;
  flex-flow: column wrap;
  justify-content: center;
  align-items: center;
}

#legend-gradient {
  width: 20%;
  height: 15px;
  background: linear-gradient(90deg, var(--color0) 0%, var(--color0) 17%, var(--color1) 17%, var(--color1) 34%, var(--color2) 34%, var(--color2) 51%, var(--color3) 51%, var(--color3) 68%, var(--color4) 68%, var(--color4) 84%, var(--color5) 84%, var(--color5) 100%);
  margin-bottom: 10px;
}

#legend span {
  font-size: 1.2rem;
  margin-bottom: 5px;
}

Your browser information:

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

Challenge Information:

Build an Availability Table - Build an Availability Table

Hi can you please update your post with your code and describe the issues you had in more detail?

I updated my code. The fourth step is about the number of columns. I tried to change all th’s elements to td’s (except the th’s in first row) and it didn’t work. I tried to remove the thead element and it didn’t work as well. I tried a few more things, searched here and in google and couldn’t find a final answer to solve this problem.

Do all of your table rows have at least 4 columns?

Do all of your .time columns have a time value?

Here is an example of the correct syntax to use for the linear-gradient:

MDN: Linear Gradient with Multi-Position Color Stops

I fixed it. Thanks for the help.