Build an Availability Table - Build an Availability Table

Tell us what’s happening:

  1. You should use two color-stops (expressed in percentage) to make the transition from one color to the following color a hard line for your #legend-gradient. Remember to use your --color# variables.

I really cannot see what is 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">
    <link rel="stylesheet" href="styles.css">
    <title>Availability Table</title>
</head>

<body>
    <table>
        <tr>
            <th class="time">9am</th>
            <th class="time">10pm</th>
            <th class="time">1am</th>
            <th class="time">6pm</th>
        </tr>
        <tr class="sharp">
            <td class="available-0"></td>
            <td class="available-1"></td>
            <td class="available-2"></td>
            <td class="available-5"></td>
        </tr>
        <tr class="half">
            <td class="available-3"></td>
            <td class="available-4"></td>
            <td class="available-5"></td>
            <td class="available-1"></td>
        </tr>
        <tr class="sharp">
            <td class="available-2"></td>
            <td class="available-5"></td>
            <td class="available-5"></td>
            <td class="available-4"></td>
        </tr>
        <tr class="half">
            <td class="available-1"></td>
            <td class="available-1"></td>
            <td class="available-3"></td>
            <td class="available-1"></td>
        </tr>
        
    </table>

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

</html>
/* file: styles.css */
:root {
  --color0: #32a852;
  --color1: #a85932;
  --color2: #a8329a;
  --color3: #98f5ea;
  --color4: #28204d;
  --color5: #e7f705;
  --solid-border: solid 3px white;
  --dashed-border: dashed 3px white;
}

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

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

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

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

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

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

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

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

#legend-gradient {
  height: 20px;
  width: 40px;
  background-image: linear-gradient(to right, var(--color0) 0%, var(--color0) 12.5%, var(--color1) 12.5%, var(--color1) 30%, var(--color2) 30%, var(--color2) 55%, var(--color3) 55%, var(--color3) 75%, var(--color4) 75%, var(--color4) 95%, var(--color5) 95%, var(--color5) 100%);
}

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36

Challenge Information:

Build an Availability Table - Build an Availability Table

var(--color0) 0%, 
var(--color0) 12.5%, 
var(--color1) 12.5%,

You are using 1 color stop here (per line). Check the example here:
https://www.w3schools.com/CSSref/func_linear-gradient.php

Example

A linear gradient with two-position color stops:
#grad {
  background: linear-gradient(
    to right,
    red 17%,
    orange 17% 34%,
    yellow 34% 51%,
    green 51% 68%,
    blue 68% 84%,
    indigo 84%
  );
} 

Also note that you don’t need to write 0% or 100%, it is interpolated (Tests do not like it)

the tests accept both with and without 0% and 100%

the issue is that the tests don’t recognise decimal numbers, the percentages should be whole numbers

1 Like

Thank you, it works when I used whole number