Build an Availability Table - Build an Availability Table

Tell us what’s happening:

I’m having trouble with this question: 35. 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.

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>Time</th>
    <th>Monday</th>
    <th>Tuesday</th>
    <th>Wednesday</th>
    <th>Thursday</th>
    <th>Friday</th>
  </tr>

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

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

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

  <tr class="sharp">
    <th class="time">13:00</th>
    <td class="available-1">d</td>
    <td class="available-2">d</td>
    <td class="available-3">d</td>
    <td class="available-4">d</td>
    <td class="available-5">d</td>
  </tr>

</table>

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

</body>
</html>


:root {
  --solid-border: 2px solid black;
  --dashed-border: 2px dashed black;

  --color0: #ff0000;
  --color1: #ff7000;
  --color2: #ffd400;
  --color3: #70cf00;
  --color4: #00c5eb;
  --color5: #0200ff;
}


table {
  border-collapse: collapse;
}

th, td {
  width: 60px;
  height: 30px;
  text-align: center;
}


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


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

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


#legend {
  margin-top: 20px;
}

#legend-gradient {
  width: 120px;
  height: 10px;
  background-image: linear-gradient(
    90deg,
    var(--color0) 0%,
    var(--color0) 16%,
    var(--color1) 16%,
    var(--color1) 33%,
    var(--color2) 33%,
    var(--color2) 50%,
    var(--color3) 50%,
    var(--color3) 66%,
    var(--color4) 66%,
    var(--color4) 83%,
    var(--color5) 83%,
    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/144.0.0.0 Safari/537.36

Challenge Information:

Build an Availability Table - Build an Availability Table

Please refer to this MDN example of the syntax to use for your linear gradient:

MDN: Linear Gradient with Multi-Position Color Stops

please tell me how I can pass step 35

Did you check the MDN link in the post above? If you need more help, please create your own topic. Thank you.

my question this

my question is also the above

Welcome to the forum @TrekM and @Segni1!

You have to use the shorthand version.

instead of:

// working, but not suitable for the test
background-image: linear-gradient(
    90deg,
    red 0%,
    red 16%,
    blue 50%,
    blue 100%

use the shorthand version:

// the correct approach to past the test
background-image: linear-gradient(
    90deg,
    red 0% 16%,
    blue 50% 100%

@TrekM, just courios, why you have "d"s in the last row?

1 Like

Thanks a lot, this worked. :grin: I just have the “d”s cause i wanted to see how the text in the cells would appear

1 Like