Minimal Gauge Meter In Pure CSS

Category: Chart & Graph , CSS & CSS3 | September 8, 2020
Author: rotvalli
Views Total: 808 views
Official Page: Go to website
Last Update: September 8, 2020
License: MIT

Preview:

Minimal Gauge Meter In Pure CSS

Description:

A CSS only gauge component to visualize numeric values in minimal clean gauge meters.

How to use it:

1. Download the package and load the gauge.min.css in the document.

<link rel="stylesheet" href="gauge.min.css" />

2. Create the HTML for the gauge.

<div class="gauge">
  <div class="ticks">
    <div class="tithe" style="--gauge-tithe-tick:1;"></div>
    <div class="tithe" style="--gauge-tithe-tick:2;"></div>
    <div class="tithe" style="--gauge-tithe-tick:3;"></div>
    <div class="tithe" style="--gauge-tithe-tick:4;"></div>
    <div class="tithe" style="--gauge-tithe-tick:6;"></div>
    <div class="tithe" style="--gauge-tithe-tick:7;"></div>
    <div class="tithe" style="--gauge-tithe-tick:8;"></div>
    <div class="tithe" style="--gauge-tithe-tick:9;"></div>
    <div class="min"></div>
    <div class="mid"></div>
    <div class="max"></div>
  </div>
  <div class="tick-circle"></div>
  <div class="needle">
    <div class="needle-head"></div>
  </div>
  <div class="labels">
    <div class="value-label"></div>
  </div>
</div>

3. Customize the gauge with the following CSS variables.

  • –gauge-bg
  • –gauge-value
  • –gauge-display-value
<div class="gauge" style="
     --gauge-bg: #088478;
     --gauge-value:0;
     --gauge-display-value:100;">
  <div class="ticks">
    <div class="tithe" style="--gauge-tithe-tick:1;"></div>
    <div class="tithe" style="--gauge-tithe-tick:2;"></div>
    <div class="tithe" style="--gauge-tithe-tick:3;"></div>
    <div class="tithe" style="--gauge-tithe-tick:4;"></div>
    <div class="tithe" style="--gauge-tithe-tick:6;"></div>
    <div class="tithe" style="--gauge-tithe-tick:7;"></div>
    <div class="tithe" style="--gauge-tithe-tick:8;"></div>
    <div class="tithe" style="--gauge-tithe-tick:9;"></div>
    <div class="min"></div>
    <div class="mid"></div>
    <div class="max"></div>
  </div>
  <div class="tick-circle"></div>
  <div class="needle">
    <div class="needle-head"></div>
  </div>
  <div class="labels">
    <div class="value-label"></div>
  </div>
</div>

You Might Be Interested In:


Leave a Reply