Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Styling the HTML5 Meter Tag Using the Shadow DOM
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<html>
<head>
<style type="text/css">
article {
width:520px;
height:170px;
margin: 30px auto;
font-family: Arial, sans-serif;
color: #2146CA;
font-size:17px;
background: -webkit-linear-gradient(top, rgba(219,237,239,0) 10%,rgba(219,237,239,0.7) 90%,rgba(219,237,239,1) 99%,rgba(219,237,239,1) 100%);
}
.column {
float: left;
width:240px;
margin: auto;
}
.column.left {
margin: 0 0 0 30px;
}
.column.right {
position: relative;
}
dt {
font-weight:bold;
float: left;
width:110px;
height:25px;
}
dd {
float: left;
width:80px;
height:25px;
}
/* The main meter element and star */
#raised {
-webit-style:none;
position: relative;
background-image:url(star.svg);
height:150px;
width:150px;
position: absolute;
right:20px;
}
/* The overlay shadow */
#raised:before {
content: '';
background-color:#fff;
opacity: 0.2;
height:60;
width:115;
position: absolute;
top:0;
left:17.5px;
z-index:5;
margin: 16px 0 0 0;
border-radius: 100px;
border-bottom-right-radius: 10px;
border-bottom-left-radius: 10px;
}
/* The percentage */
#raised:after {
content: "60%";
position: absolute;
top:65px;
right:36%;
font-family: Arial, sans-serif;
font-weight:bold;
color: #fff;
}
/**
* Shadow Dom Elements
*/
/* The central circle */
#raised::-webkit-meter-bar {
-webkit-transform: rotate(270deg);
-webkit-mask-image: url(circle.svg);
background:none;
margin: 25px 0 00px 25;
width:100px;
height:100px;
}
/* The area of the meter indicating the value */
#raised::-webkit-meter-optimum-value {
background:#134A6F;
}
</style>
</head>
<body>
<article>
<div class="column left">
<dl>
<dt>Target:</dt>
<dd>&pound;200</dd>
<dt>Raised so far:</dt>
<dd>&pound;120</dd>
</dl>
</div>
<div class="column right">
<meter id="raised" min="0" max="200" value="120" title="pounds">60%</meter>
</div>
</article>
</body>
</html>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.