<div class="container">
  <h1 class="level-1 rectangle">CEO</h1>
  <ol class="level-2-wrapper">
    <li>
      <h2 class="level-2 rectangle">Director A</h2>
      <ol class="level-3-wrapper">
        <li>
          <h3 class="level-3 rectangle">Manager A</h3>
          <ol class="level-4-wrapper">
            <li>
              <h4 class="level-4 rectangle">Person A</h4>
            </li>
            <li>
              <h4 class="level-4 rectangle">Person B</h4>
            </li>
            <li>
              <h4 class="level-4 rectangle">Person C</h4>
            </li>
            <li>
              <h4 class="level-4 rectangle">Person D</h4>
            </li>
          </ol>
        </li>
        <li>
          <h3 class="level-3 rectangle">Manager B</h3>
          <ol class="level-4-wrapper">
            <li>
              <h4 class="level-4 rectangle">Person A</h4>
            </li>
            <li>
              <h4 class="level-4 rectangle">Person B</h4>
            </li>
            <li>
              <h4 class="level-4 rectangle">Person C</h4>
            </li>
            <li>
              <h4 class="level-4 rectangle">Person D</h4>
            </li>
          </ol>
        </li>
      </ol>
    </li>
    <li>
      <h2 class="level-2 rectangle">Director B</h2>
      <ol class="level-3-wrapper">
        <li>
          <h3 class="level-3 rectangle">Manager C</h3>
          <ol class="level-4-wrapper">
            <li>
              <h4 class="level-4 rectangle">Person A</h4>
            </li>
            <li>
              <h4 class="level-4 rectangle">Person B</h4>
            </li>
            <li>
              <h4 class="level-4 rectangle">Person C</h4>
            </li>
            <li>
              <h4 class="level-4 rectangle">Person D</h4>
            </li>
          </ol>
        </li>
        <li>
          <h3 class="level-3 rectangle">Manager D</h3>
          <ol class="level-4-wrapper">
            <li>
              <h4 class="level-4 rectangle">Person A</h4>
            </li>
            <li>
              <h4 class="level-4 rectangle">Person B</h4>
            </li>
            <li>
              <h4 class="level-4 rectangle">Person C</h4>
            </li>
            <li>
              <h4 class="level-4 rectangle">Person D</h4>
            </li>
          </ol>
        </li>
      </ol>
    </li>
  </ol>
</div>

<footer class="page-footer">
  <span>made by </span>
  <a href="https://georgemartsoukos.com/" target="_blank">
    <img width="24" height="24" src="https://assets.codepen.io/162656/george-martsoukos-small-logo.svg" alt="George Martsoukos logo">
  </a>
</footer>
/* RESET STYLES & HELPER CLASSES
–––––––––––––––––––––––––––––––––––––––––––––––––– */
:root {
  --level-1: #8dccad;
  --level-2: #f5cc7f;
  --level-3: #7b9fe0;
  --level-4: #f27c8d;
  --black: black;
}

* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

ol {
  list-style: none;
}

body {
  margin: 50px 0 100px;
  text-align: center;
  font: 20px/1.5 "Inter", sans-serif;
}

h1,
h2,
h3,
h4 {
  font-size: inherit;
}

.container {
  max-width: 800px;
  padding: 0 10px;
  margin: 0 auto;
  display: grid;
  align-items: center;
  justify-content: center;
  grid-column-gap: 20px;
  grid-template-columns: auto auto;
}

.rectangle {
  position: relative;
  padding: 20px;
  width: 200px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}


/* LEVEL-1 STYLES
–––––––––––––––––––––––––––––––––––––––––––––––––– */
.level-1 {
  background: var(--level-1);
}

.level-1::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 100%;
  transform: translateY(-50%);
  width: 20px;
  height: 2px;
  background: var(--black);
}


/* LEVEL-2 STYLES
–––––––––––––––––––––––––––––––––––––––––––––––––– */
.level-2-wrapper {
  position: relative;
  padding-left: 20px;
  border-left: 2px solid var(--black);
}

.level-2-wrapper::before {
  display: none;
  content: "";
  position: absolute;
  top: -20px;
  left: 10px;
  width: 2px;
  height: calc(100% + 40px);
  background: var(--black);
}

.level-2-wrapper::after {
  display: none;
  content: "";
  position: absolute;
  left: 10px;
  bottom: -20px;
  width: calc(100% - 10px);
  height: 2px;
  background: var(--black);
}

.level-2-wrapper > li {
  position: relative;
  display: grid;
  align-items: flex-start;
  grid-column-gap: 20px;
  grid-template-columns: auto auto;
}

.level-2-wrapper > li:last-child {
  margin-top: 100px;
  align-items: flex-end;
}

.level-2 {
  background: var(--level-2);
}

.level-2::before {
  content: "";
  position: absolute;
  top: 50%;
  right: 100%;
  transform: translateY(-50%);
  width: 20px;
  height: 2px;
  background: var(--black);
}

.level-2::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 100%;
  transform: translateY(-50%);
  width: 20px;
  height: 2px;
  background: var(--black);
}


/* LEVEL-3 STYLES
–––––––––––––––––––––––––––––––––––––––––––––––––– */
.level-3-wrapper {
  position: relative;
  top: 34px;
  padding-left: 20px;
  border-left: 2px solid var(--black);
}

.level-3-wrapper::before {
  display: none;
  content: "";
  position: absolute;
  top: 0;
  left: 10px;
  width: 2px;
  height: 100%;
  background: var(--black);
}

.level-3-wrapper::after {
  display: none;
  content: "";
  position: absolute;
  left: 10px;
  bottom: 0px;
  width: calc(100% - 10px);
  height: 2px;
  background: var(--black);
}

.level-3-wrapper > li {
  display: grid;
  grid-column-gap: 20px;
  grid-template-columns: auto auto;
}

.level-3-wrapper > li:last-child {
  margin-top: 80px;
}

.level-2-wrapper > li:last-child .level-3-wrapper {
  top: -34px;
}

.level-3 {
  background: var(--level-3);
}

.level-3::before {
  content: "";
  position: absolute;
  top: 50%;
  right: 100%;
  transform: translateY(-50%);
  width: 20px;
  height: 2px;
  background: var(--black);
}

.level-3::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 100%;
  transform: translateY(-50%);
  width: 20px;
  height: 2px;
  background: var(--black);
}


/* LEVEL-4 STYLES
–––––––––––––––––––––––––––––––––––––––––––––––––– */
.level-4-wrapper {
  position: relative;
  top: 34px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-column-gap: 20px;
  padding-left: 20px;
}

.level-4-wrapper::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 2px;
  height: 50%;
  background: var(--black);
}

.level-3-wrapper > li:last-child .level-4-wrapper {
  top: -34px;
}

.level-3-wrapper > li:last-child .level-4-wrapper::before {
  top: auto;
  bottom: 0;
}

.level-4 {
  background: var(--level-4);
}

.level-4::before {
  content: "";
  position: absolute;
  top: 50%;
  right: 100%;
  transform: translateY(-50%);
  width: 20px;
  height: 2px;
  background: var(--black);
}


/* MQ STYLES
–––––––––––––––––––––––––––––––––––––––––––––––––– */
@media screen and (max-width: 1650px) {
  .rectangle {
    width: 150px;
  }
}

@media screen and (max-width: 1300px) {
  body {
    font-size: 16px;
  }
  
  h1,
  h2,
  h3,
  h4 {
    font-size: revert;
  }

  .rectangle {
    padding: 20px 10px;
    width: auto;
  }

  .container {
    display: block;
  }

  .level-1 {
    margin-bottom: 20px;
  }

  .level-1::before,
  .level-2::after,
  .level-3::after {
    display: none;
  }

  .level-2-wrapper::before,
  .level-2-wrapper::after,
  .level-3-wrapper::before,
  .level-3-wrapper::after,
  .level-2-wrapper > li,
  .level-3-wrapper > li {
    display: block;
  }

  .level-2-wrapper {
    padding-left: 30px;
    border-left: none;
  }

  .level-2-wrapper > li:last-child {
    margin-top: 50px;
  }

  .level-2-wrapper > li:last-child .level-3-wrapper,
  .level-3-wrapper > li:last-child .level-4-wrapper,
  .level-3-wrapper,
  .level-4-wrapper {
    top: 0;
  }

  .level-3-wrapper {
    padding: 20px 0 20px 30px;
    border-left: none;
  }

  .level-3-wrapper > li:last-child {
    margin-top: 50px;
  }

  .level-4-wrapper {
    padding: 20px 0 0 30px;
    grid-template-columns: repeat(2, 1fr);
  }

  .level-4-wrapper > li:first-child {
    margin-bottom: 20px;
  }

  .level-4-wrapper::before {
    left: 10px;
    height: 100%;
  }
}


/* FOOTER
–––––––––––––––––––––––––––––––––––––––––––––––––– */
.page-footer {
  position: fixed;
  right: 0;
  bottom: 20px;
  font-size: 1rem;
  display: flex;
  align-items: center;
  padding: 5px;
}

.page-footer a {
  margin-left: 4px;
}

External CSS

  1. https://fonts.googleapis.com/css2?family=Inter:wght@400;700&amp;display=swap

External JavaScript

This Pen doesn't use any external JavaScript resources.