Chart example

by danifox

HTML

<div class="page">
<div class="chart">
  <h3 class="chart__title"></h3>
  <div class="chart__body">
    <div class="chart__datasets">
      
    </div>
    <div class="chart__canvas">
    
    </div>
  </div>
</div>
</div>

SCSS

html, body {
    height: 100%;
}

.page {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ecf0f1;
}

.chart {
  width: 450px;
  padding: 15px 15px;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  position: relative;
  background: #fff;
  border: 1px solid #7f8c8d;
  &__title {
    position: absolute;
    top: 0;
    left: 15px;
    background: #3498db;
    width: 50%;
    height: 25px;
  }
  &__body {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    flex-grow: 1;
    column-gap: 15px;
  }
  &__datasets {
    width: 70%;
    height: 50px;
    background: #f1c40f;
  }
  &__canvas {
    background: #2ecc71;
    width: 100px;
    height: 100px;
  }
}

@media (max-width: 600px) {
  .chart {
    &__body {
      margin-top: 60px;
      flex-direction: column-reverse;
      align-items: normal;
      row-gap: 15px;
    }
    &__datasets {
      width: 100%;
      flex-grow: 1;
    }
    &__canvas {
      width: 100%;
      height: 50px;
    }
  }
}