Build an Availability Table - Build an Availability Table

Tell us what’s happening:

#legend-gradient {
width: 400px;
height: 20px;
background-image: linear-gradient(
to right,
var(–color0) 0%, var(–color0) 16.66%,
var(–color1) 16.66%, var(–color1) 33.33%,
var(–color2) 33.33%, var(–color2) 50%,
var(–color3) 50%, var(–color3) 66.66%,
var(–color4) 66.66%, var(–color4) 83.33%,
var(–color5) 83.33%, var(–color5) 100%
);
}
why is my test not passed

Your code so far

<!-- file: index.html -->
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8" />
  <title>Availability Table</title>
  <link rel="stylesheet" href="styles.css" />
</head>
<body>

  <table>
    <tr>
      <th class="time">08:00</th>
      <th>Room A</th>
      <th>Room B</th>
      <th>Room C</th>
    </tr>

    <tr class="sharp">
      <th class="time">09:00</th>
      <td class="available-1"></td>
      <td class="available-3"></td>
      <td class="available-5"></td>
    </tr>

    <tr class="half">
      <th class="time">10:00</th>
      <td class="available-2"></td>
      <td class="available-0"></td>
      <td class="available-4"></td>
    </tr>

    <tr class="sharp">
      <th class="time">11:00</th>
      <td class="available-0"></td>
      <td class="available-2"></td>
      <td class="available-1"></td>
    </tr>

    <tr class="half">
      <th class="time">12:00</th>
      <td class="available-3"></td>
      <td class="available-4"></td>
      <td class="available-2"></td>
    </tr>
  </table>

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

</body>
</html>

/* file: styles.css */
:root{
  --color0: #e0e0e0;
  --color1: #a8dadc;
  --color2: #457b9d;
  --color3: #1d3557;
  --color4: #ffb703;
  --color5: #d00000;

  --solid-border: 3px solid black;
  --dashed-border: 3px dashed black;
}

table {
  border-collapse: collapse;
  width: 90%;
  margin: 20px;
}

th, td {
  padding: 8px;
  text-align: center;
  border: 1px solid #333;
}

/* time cells in first column */
th.time {
  text-align: left;
}

/* availability color classes */
.available-0 { background-color: var(--color0); }
.available-1 { background-color: var(--color1); }
.available-2 { background-color: var(--color2); color: white; }
.available-3 { background-color: var(--color3); color: white; }
.available-4 { background-color: var(--color4); }
.available-5 { background-color: var(--color5); color: white; }

/* borders for sharp and half rows (bottom borders) */
.sharp td {
  border-bottom: var(--solid-border);
}

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

/* legend */
#legend {
  margin-top: 16px;
}

/* Hard-stop gradient using two stops per transition (percentages) */
#legend-gradient {
  width: 400px;
  height: 20px;
  background-image: linear-gradient(
    to right,
    var(--color0) 0%, var(--color0) 16.66%,
    var(--color1) 16.66%, var(--color1) 33.33%,
    var(--color2) 33.33%, var(--color2) 50%,
    var(--color3) 50%, var(--color3) 66.66%,
    var(--color4) 66.66%, var(--color4) 83.33%,
    var(--color5) 83.33%, var(--color5) 100%
  );
}


Your browser information:

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

Challenge Information:

Build an Availability Table - Build an Availability Table
https://www.freecodecamp.org/learn/full-stack-developer/lab-availability-table/build-an-availability-table

Hi @oladapoamoo430 and welcome to our community!

If you want two colour stops for a variable, you don’t need to restate the variable name:

EXAMPLE:

var(--mycolour) 0% 10%,

Also, you should round all of the values to the nearest integer.

1 Like

mine still not passing

If you have a question about a specific challenge as it relates to your written code for that challenge and need some help, click the Get Help > Ask for Help button located on the challenge.

The Ask for Help button will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.

Thank you.