← All elements

Thermometer Loader

by @admin · 2 views

<div class="loaderWrapper">
  <div class="blue partOne">
    <div class="gray partOneChild">
      <div class="redFill partOneChildChild">
        <div class="shine"></div>
        <div class="measurements"></div>
       </div>
    </div>
  </div>
  <div class="blue partTwo">
    <div class="gray partTwoChild">
      <div class="redFill partTwoChildChild"></div>
    </div>
  </div>
</div>

About this loader

A tall glass thermometer whose red mercury rises and falls using an animated custom property, while the whole body shakes. Shine and tick marks are drawn in CSS.

How it works

An @property declaration lets a custom property for the fill height be animated like a length. A gradient with a hard stop at that value draws the red mercury, so as the property climbs the red area rises and falls. The whole body shakes with a long keyframe of tiny left and right moves.

Ways to customise it

  • Change --loaderHeight to resize the thermometer.
  • Edit --animationDuration.
  • Recolour the mercury hsl values.

Good to know

@property is supported in current Chrome, Edge and Safari, and in recent Firefox. Where it is missing the mercury stays still but the shake works.

Open an example, copy the HTML and the CSS, and paste them into your page. There is nothing to install and no JavaScript to load.

More in Loaders

View all →