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 Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

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.

            
              <h1>Styling Attribute Ranges</h1>
<h2>with Element Queries</h2>

<label for=low>
  <input id=low type=range min=0 max=30 oninput="high.value=Math.max(value,high.value)" value=10>
</label>
<label for=high>
  <input id=high type=range min=0 max=30 oninput="low.value=Math.min(value,low.value)" value=20>
</label>

<ul>
  <li data-num=1>One
  <li data-num=2>Two
  <li data-num=3>Three
  <li data-num=4>Four
  <li data-num=5>Five
  <li data-num=6>Six
  <li data-num=7>Seven
  <li data-num=8>Eight
  <li data-num=9>Nine
  <li data-num=10>Ten
  <li data-num=11>Eleven
  <li data-num=12>Twelve
  <li data-num=13>Thirteen
  <li data-num=14>Fourteen
  <li data-num=15>Fifteen
  <li data-num=16>Sixteen
  <li data-num=17>Seventeen
  <li data-num=18>Eightteen
  <li data-num=19>Nineteen
  <li data-num=20>Twenty
  <li data-num=21>Twenty One
  <li data-num=22>Twenty Two
  <li data-num=23>Twenty Three
  <li data-num=24>Twenty Four
  <li data-num=25>Twenty Five
  <li data-num=26>Twenty Six
  <li data-num=27>Twenty Seven
  <li data-num=28>Twenty Eight
  <li data-num=29>Twenty Nine
  <li data-num=30>Thirty
</ul>
            
          
!
            
              label {
  display: block;
  text-align: center;
  padding: 1em;
  float: left;
  width: 50%;
}
label:before,
label:after {
  display: block;
  font-weight: 900;
  font-size: 24pt;
  margin: 1em 0;
}
label:after {
  font-size: 18pt;
  font-weight: 400;
  margin: .5em 0;
}
[for=low]:before {
  content: 'Min';
}
[for=high]:before {
  content: 'Max';
}
input {
 width: 100%;
}
ul{
  clear: both;
}
@element [type=range] {
  $parent:after {
    content: 'eval('value')';
  }
}
@element [data-num] {

  /* Select elements between Min and Max slider value */
  eval('
    var num = parseInt(getAttribute("data-num"));
    low.value <= num && num <= high.value && "$this"') {
    color: black;
    background: lime;
  }

  /* Dotted white border for elements with values between 10–15 */
  eval('
    var num = parseInt(getAttribute("data-num"));
    10 <= num && num <= 15 && "$this"') {
    border: 1px dotted red;
  }

}
            
          
!
999px
Loading ..................

Console