cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <script src="//variancecharts.com/cdn/variance-noncommercial-standalone-f47ffcf.min.js" charset="UTF-8"></script>

<link href="//fonts.googleapis.com/css?family=Signika:400" rel="stylesheet" type="text/css">

<link id="pop_age_asia" rel="variance-data" href="//variancecharts.com/data/population_age_asia.csv">
<link id="pop_age_africa" rel="variance-data" href="//variancecharts.com/data/population_age_africa.csv">
<link id="pop_age_europe" rel="variance-data" href="//variancecharts.com/data/population_age_europe.csv">

<div id="population_age">

  <div class="title">
    <div class="asia region">
      <div class="total_population">4,165.44 million</div>
      <h2>Asia</h2>
      <div class="total_population">5,164.06 million</div>
    </div>
    <div class="africa region">
      <div class="total_population">1,031.08 million</div>
      <h2>Africa</h2>
      <div class="total_population">2,393.17 million</div>
    </div>
    <div class="europe region">
      <div class="total_population">740.30 million</div>
      <h2>Europe</h2>
      <div class="total_population">709.06 million</div>
    </div>
    <div class="legend">
      <div class="total_population">2010</div>
      <h2>Population</h2>
      <div class="total_population">2050</div>
    </div>
  </div>

  <chart scale-y-linear="0 16">
    <div class="legend">
      <h3>Percentage of Total Population Divided by Age</h3>
      <div class="year">
        <div class="ten"></div>
        <span class="text">2010</span>
      </div>
      <div class="year">
        <div class="fifty"></div>
        <span class="text">2050</span>
      </div>
    </div>
    <guide-y>
      <span class="label">{{value}}%</span>
    </guide-y>
    <groups by="Year" data="#pop_age_asia" class="asia">
      <repeat>
        <bar map-length="percentage_of_pop"></bar>
        <annotation class="bottom">
          <span class="rotate">{{Age}}</span>
        </annotation>
      </repeat>
    </groups>
    <groups by="Year" data="#pop_age_africa" class="africa">
      <repeat>
        <bar map-length="percentage_of_pop"></bar>
        <annotation class="bottom">
          <span class="rotate">{{Age}}</span>
        </annotation>
      </repeat>
    </groups>
    <groups by="Year" data="#pop_age_europe" class="europe">
      <repeat>
        <bar map-length="percentage_of_pop"></bar>
        <annotation class="bottom">
          <span class="rotate">{{Age}}</span>
        </annotation>
      </repeat>
    </groups>
  </chart>

</div>
            
          
!
            
              #population_age {
  width: 80%;
  padding: 60px 60px 80px 140px;
  color: #666666;
  font-family: Signika, Helvetica, Arial, sans-serif;
}
#population_age chart {
  width: 100%;
  height: 400px;
  display: flex;
  display: -webkit-flex;
  justify-content: space-between;
  -webkit-justify-content: space-between;
}
@media (min-width: 1200px) {
  #population_age chart {
    height: 600px;
  }
}
#population_age groups {
  width: 30%;
}
#population_age guide-y {
  border-color: #888888;
  left: -50px;
}
#population_age guide-y .tick {
  border-color: #888888;
}
#population_age group {
  position: absolute;
  margin: 0;
}
#population_age bar {
  margin: 0 1px;
  border: none;
}
#population_age annotation {
  font-size: 12px;
  bottom: -8px;
}
@media (max-width: 1200px) {
  #population_age datum:nth-child(even) annotation {
    display: none;
  }
}
#population_age .africa group:first-child bar {
  background-color: rgba(229, 178, 89, 0.6);
}
#population_age .africa group:last-child bar {
  border: 1px solid #cc8e20;
  background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHdpZHRoPSc0JyBoZWlnaHQ9JzgnIHZpZXdCb3g9JzAgMCA1IDEwJz4KCTxyZWN0IHdpZHRoPScxMTAlJyB4PSctNSUnIHk9Jy01JScgaGVpZ2h0PScxMTAlJyBmaWxsPScjZmZmZmZmJyBmaWxsLW9wYWNpdHk9IjAiIC8+Cgk8bGluZSB4MT0nLTInIHkxPScxJyB4Mj0nNycgeTI9JzEwJyBzdHJva2U9JyNiNDc5MjMnIHN0cm9rZS13aWR0aD0nMScvPgoJPGxpbmUgeDE9Jy0yJyB5MT0nNicgeDI9JzcnIHkyPScxNScgc3Ryb2tlPScjYjQ3OTIzJyBzdHJva2Utd2lkdGg9JzEnLz4KCTxsaW5lIHgxPSctMicgeTE9Jy00JyB4Mj0nNycgeTI9JzUnIHN0cm9rZT0nI2I0NzkyMwknIHN0cm9rZS13aWR0aD0nMScvPgo8L3N2Zz4=");
  background-color: rgba(229, 178, 89, 0);
}
#population_age .asia group:first-child bar {
  background-color: rgba(102, 168, 212, 0.4);
}
#population_age .asia group:last-child bar {
  border: 1px solid #569fd0;
  background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHdpZHRoPSc0JyBoZWlnaHQ9JzgnIHZpZXdCb3g9JzAgMCA1IDEwJz4KCTxyZWN0IHdpZHRoPScxMTAlJyB4PSctNSUnIHk9Jy01JScgaGVpZ2h0PScxMTAlJyBmaWxsPScjZmZmZmZmJyBmaWxsLW9wYWNpdHk9IjAiIC8+Cgk8bGluZSB4MT0nLTInIHkxPScxJyB4Mj0nNycgeTI9JzEwJyBzdHJva2U9JyM1YTk2YmQnIHN0cm9rZS13aWR0aD0nMScvPgoJPGxpbmUgeDE9Jy0yJyB5MT0nNicgeDI9JzcnIHkyPScxNScgc3Ryb2tlPScjNWE5NmJkJyBzdHJva2Utd2lkdGg9JzEnLz4KCTxsaW5lIHgxPSctMicgeTE9Jy00JyB4Mj0nNycgeTI9JzUnIHN0cm9rZT0nIzVhOTZiZCcgc3Ryb2tlLXdpZHRoPScxJy8+Cjwvc3ZnPg==");
  background-color: rgba(102, 168, 212, 0);
}
#population_age .europe group:first-child bar {
  background-color: rgba(194, 200, 78, 0.6);
}
#population_age .europe group:last-child bar {
  border: 1px solid #a7ad36;
  background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHdpZHRoPSc0JyBoZWlnaHQ9JzgnIHZpZXdCb3g9JzAgMCA1IDEwJz4KCTxyZWN0IHdpZHRoPScxMTAlJyB4PSctNSUnIHk9Jy01JScgaGVpZ2h0PScxMTAlJyBmaWxsPScjZmZmZmZmJyBmaWxsLW9wYWNpdHk9IjAiIC8+Cgk8bGluZSB4MT0nLTInIHkxPScxJyB4Mj0nNycgeTI9JzEwJyBzdHJva2U9JyNhN2FkMzYnIHN0cm9rZS13aWR0aD0nMScvPgoJPGxpbmUgeDE9Jy0yJyB5MT0nNicgeDI9JzcnIHkyPScxNScgc3Ryb2tlPScjYTdhZDM2JyBzdHJva2Utd2lkdGg9JzEnLz4KCTxsaW5lIHgxPSctMicgeTE9Jy00JyB4Mj0nNycgeTI9JzUnIHN0cm9rZT0nI2E3YWQzNgknIHN0cm9rZS13aWR0aD0nMScvPgo8L3N2Zz4=");
  background-color: rgba(194, 200, 78, 0);
}
#population_age chart .legend {
  position: absolute;
  right: 0;
  top: 20px;
  text-align: right;
}
#population_age chart .legend h3 {
  margin: 0 0 8px 0;
  font-weight: normal;
  font-size: 18px;
  width: 220px;
}
@media (min-width: 1200px) {
  #population_age chart .legend h3 {
    font-size: 22px;
    width: 280px;
  }
}
#population_age chart .legend .year {
  display: inline-block;
}
#population_age chart .legend .text {
  font-size: 14px;
  line-height: 1;
  margin-left: 4px;
}
@media (min-width: 1200px) {
  #population_age chart .legend .text {
    font-size: 18px;
  }
}
#population_age chart .legend .ten, #population_age chart .legend .fifty {
  width: 14px;
  height: 14px;
  background-color: #e6e2d6;
  float: left;
  margin-left: 8px;
}
@media (min-width: 1200px) {
  #population_age chart .legend .ten, #population_age chart .legend .fifty {
    width: 18px;
    height: 18px;
  }
}
#population_age chart .legend .fifty {
  background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHdpZHRoPSc0JyBoZWlnaHQ9JzgnIHZpZXdCb3g9JzAgMCA1IDEwJz4KCTxyZWN0IHdpZHRoPScxMTAlJyB4PSctNSUnIHk9Jy01JScgaGVpZ2h0PScxMTAlJyBmaWxsPScjZmZmZmZmJyBmaWxsLW9wYWNpdHk9IjAiIC8+Cgk8bGluZSB4MT0nLTInIHkxPScxJyB4Mj0nNycgeTI9JzEwJyBzdHJva2U9JyNhOGE2YTAnIHN0cm9rZS13aWR0aD0nMScvPgoJPGxpbmUgeDE9Jy0yJyB5MT0nNicgeDI9JzcnIHkyPScxNScgc3Ryb2tlPScjYThhNmEwJyBzdHJva2Utd2lkdGg9JzEnLz4KCTxsaW5lIHgxPSctMicgeTE9Jy00JyB4Mj0nNycgeTI9JzUnIHN0cm9rZT0nI2E4YTZhMAkJJyBzdHJva2Utd2lkdGg9JzEnLz4KPC9zdmc+");
  border: 1px solid #a8a6a0;
}
#population_age .title {
  width: 100%;
  margin-bottom: 36px;
  display: flex;
  display: -webkit-flex;
  justify-content: space-between;
  position: relative;
}
#population_age .title .region {
  text-align: center;
  width: 30%;
}
#population_age .title h2 {
  margin: 0;
  padding: 8px 0;
  font-size: 15px;
  color: #444444;
  font-weight: normal;
}
#population_age .title .total_population {
  font-size: 13px;
  color: #888888;
  background-color: #eeebe3;
  padding: 6px 0;
}
#population_age .title .legend {
  position: absolute;
  left: -90px;
  width: 80px;
  text-align: right;
}
#population_age .title .legend .total_population {
  background: none;
}
#population_age .title .legend h2 {
  font-size: 14px;
}

            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console