Build an Availability Table - Build an Availability Table

Tell us what’s happening:

I’m block to the 12. You should have at least eight .available-# elements, where # is a number between 0 and 5. and i don’t know what i am doing wrong

Your code so far

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

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

<body>
    <table>
        <tbody>
        <tr class="sharp">
            <th rowspan="2" class="time">9AM</th>
            <th>Monday</th>
            <th>Tuesday</th>
            <th>Wednesday</th>
            <th>Thursday</th>
            <th>Friday</th>
        </tr>
    
        <tr class="half">
            <td class="available-0"></td>
            <td class="available-1"></td>
            <td class="available-2"></td>
            <td class="available-2"></td>
            <td class="available-5"></td>
        </tr>

        <tr class="sharp">
            <th rowspan="2" class="time">10AM</th>
            <th class="available-3"></th>
            <th class="available-4"></th>
            <th class="available-4"></th>
            <th class="available-5"></th>
            <th class="available-5"></th>
        </tr>

        <tr class="half">
            <th class="available-3"></th>
            <th class="available-4"></th>
            <th class="available-5"></th>
            <th class="available-5"></th>
            <th class="available-5"></th>
        </tr>

        <tr class="sharp">
            <th rowspan="2" class="time">11AM</th>
            <th class="available-0"></th>
            <th class="available-2"></th>
            <th class="available-4"></th>
            <th class="available-3"></th>
            <th class="available-0"></th>
        </tr>

        <tr class="half">
            <th class="available-4"></th>
            <th class="available-5"></th>
            <th class="available-3"></th>
            <th class="available-2"></th>
            <th class="available-1"></th>
        </tr>

        <tr class="sharp">
            <th rowspan="2" class="time">12AM</th>
            <th class="available-1"></th>
            <th class="available-2"></th>
            <th class="available-3"></th>
            <th class="available-4"></th>
            <th class="available-5"></th>
        </tr>

        <tr class="half">
            <th class="available-5"></th>
            <th class="available-0"></th>
            <th class="available-0"></th>
            <th class="available-3"></th>
            <th class="available-0"></th>
        </tr>

        </tbody>
        <div id="legend">
            <span>Availability</span>
            <div id="legend-gradient"></div>
        </div>
    </table>
</body>

</html> -->

/* file: styles.css:root {
  font-size: 16px;
  font-family: Arial, Helvetica, sans-serif;
  --color0: hsl(0,0%,100%);
  --color1: hsl(120,95%,90%);
  --color2: hsl(120,95%,80%);
  --color3: hsl(120,95%,65%);
  --color4: hsl(120,95%,40%);
  --color5: hsl(120,95%,25%);
  --solid-border: 0.1rem solid black;
  --dashed-border: 0.09rem dashed black;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: hsl(150,30%,75%);
  width: 100vw;
  height: 100vh;
}

main {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-evenly;
}

table {
  border-collapse: collapse;
  table-layout: fixed;
  width: 32rem;
}

tr {
  height: 1.1rem;
}

tr:first-child {
  width: 4rem;
}

td {
  border-right: var(--solid-border);
  border-left: var(--solid-border);
}

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

.sharp th:not([class*="time"]) {
  border-bottom: var(--solid-border);
}

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

tbody:last-of-child td {
  border: 0;
}

.time {
  text-align: right;
  border: 0;
  padding: 0.4rem;
}

.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);
}

#legend {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 18rem;
  height: 3.5rem;
  text-align: center;
}

#legend span {
  display: inline-block;
  width: 5rem;
  height: 2rem;
}

#legend-gradient {
  width: 100%;
  height: 60%;
  border: var(--solid-border);
  background-image: linear-gradient(90deg,
    var(--color0) 0% 17%,
    var(--color1) 17% 34%,
    var(--color2) 34% 50%,
    var(--color3) 50% 67%,
    var(--color4) 67% 83%,
    var(--color5) 83% 100%
  );
} */

Your browser information:

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

Challenge Information:

Build an Availability Table - Build an Availability Table

Welcome to the forum @TanKerzzzzzz !

<th> means Table Header. It is used for as a short description for the data in it´s row or column.
Like if the are names in a row or column, the first cell will be <th>Names</th>

<td> means Table Data. It is simply used for storing data.

Please review your code, if you used those elements correctly there.

You used <tr> and <tbody> correctly.

1 Like

Thank you for your help, I understand where I was wrong !

1 Like