Build an Availability Table - Build an Availability Table

Tell us what’s happening:

I have tried this so many times after the past few weeks and still get test 35 wrong - here is my css - please could someone help!

:root {
–color0: #f2f2f2;
–color1: #cce5ff;
–color2: #99ccff;
–color3: #66b2ff;
–color4: #3399ff;
–color5: #007acc;

–solid-border: 2px solid #000;
–dashed-border: 2px dashed #000;
}

table {
width: 100%;
border-collapse: collapse;
margin-bottom: 2rem;
}

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

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>
    <thead>
      <tr>
        <th></th>
        <th>Monday</th>
        <th>Tuesday</th>
        <th>Wednesday</th>
      </tr>
    </thead>
    <tbody>
      <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-2"></td>
        <td class="available-1"></td>
        <td class="available-0"></td>
      </tr>
      <tr class="half">
        <th class="time">12:00</th>
        <td class="available-5"></td>
        <td class="available-3"></td>
        <td class="available-4"></td>
      </tr>
    </tbody>
  </table>

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

</body>
</html>

/* file: styles.css */
:root {
  --color0: #f2f2f2;
  --color1: #cce5ff;
  --color2: #99ccff;
  --color3: #66b2ff;
  --color4: #3399ff;
  --color5: #007acc;

  --solid-border: 2px solid #000;
  --dashed-border: 2px dashed #000;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 2rem;
}

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

th.time {
  text-align: left;
  background-color: #eee;
}

.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 {
  display: flex;
  align-items: center;
  gap: 1rem;
}

#legend-gradient {
  flex: 1;
  height: 30px;
  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 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15

Challenge Information:

Build an Availability Table - Build an Availability Table

Hi @kathrynreece83 and welcome to our community!

If you want to have two colour stops for each variable, you should change the formatting of your code.

EXAMPLE:

/* like this */

var(--mycolor1) 10% 20%,
var(--mycolor2) 20% 30%,
etc...

/* not like this */
var(--mycolor1) 10%, var(--mycolor1) 20%,
var(--mycolor2) 20%, var(--mycolor2) 30%,
etc...

Also, you should round the percentage values to the nearest integer.

1 Like

Absolute legend thank you so much for your help :hugs:

1 Like