Build an Availability Table - Build an Availability Table

Tell us what’s happening:

hi guys I need hep with this one 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. I don’t know why they kept refusing it please if you see this post tell me what I did wrong

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

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

  <tr class="half">
    <th class="time">10:00</th>
    <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>
  </tr>

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

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

</body>
</html>

/* file: styles.css */
:root {
  --color0: #ffffff;
  --color1: #d6ecff;
  --color2: #add8ff;
  --color3: #7fbfff;
  --color4: #4fa3ff;
  --color5: #1f87ff;

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

table {
  border-collapse: collapse;
}

th,
td {
  border: 1px solid black;
  width: 100px;
  height: 40px;
  text-align: center;
}

.time {
  font-weight: bold;
}

/* availability colors */
.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); }

/* row border styles */
.sharp td {
  border-bottom: var(--solid-border);
}

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

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

#legend-gradient {
  height: 20px;
  width: 300px;
  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/143.0.0.0 Safari/537.36 Edg/143.0.0.0

Challenge Information:

Build an Availability Table - Build an Availability Table

You simply have to use the shorthand version, because the test is very strict.
Your var(--color#) values should appear only once for each color number.

Also use whole numbers only in percentages.

Your code is normally correct.

1 Like

thank you very much I appreciate it

1 Like

Please take a look at this MDN reference for an example of the syntax for that linear gradient:

https://developer.mozilla.org/en-US/docs/Web/CSS/gradient/linear-gradient#gradient_with_multi-position_color-stops

2 Likes