123

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.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <h1>Element Query Demos with EQCSS</h1>

<h2>Width Queries</h2>

<h3>min-width (in px)</h3>
<div class=minwidthpixels data-drag=horizontal>class="minwidthpixels"</div>

<h3>min-width (in %)</h3>
<div class=minwidthpercents data-drag=horizontal>class="minwidthpercents"</div>

<h3>max-width (in px)</h3>
<div class="maxwidthpixels" data-drag=horizontal>class="maxwidthpixels"</div>

<h3>max-width (in %)</h3>
<div class="maxwidthpercents" data-drag=horizontal>class="maxwidthpercents"</div>

<h2>Height Queries</h2>

<h3>min-height (in px)</h3>
<div class="minheightpixels" data-drag=vertical>class="minheightpixels"</div>

<h3>min-height (in %)</h3>
<section>
  <div class="minheightpercents" data-drag=vertical>class="minheightpercents"</div>
</section>

<h3>max-height (in px)</h3>
<div class="maxheightpixels" data-drag=vertical>class="maxheightpixels"</div>

<h3>max-height (in %)</h3>
<section>
  <div class="maxheightpercents" data-drag=vertical>class="maxheightpercents"</div>
</section>

<h2>Count Queries</h2>

<h3>min-characters on block elements</h3>
<p>(Use keyboard)</p>
<div class="mincharacters" contenteditable>class="mincharacters"</div>

<h3>min-characters on form inputs</h3>
<p>(Use keyboard)</p>
<input type=text class="mincharacters-input" value='class="mincharacters-input"'>
<textarea class="mincharacters-textarea">class="mincharacters-textarea"</textarea>

<h3>max-characters on block elements</h3>
<p>(Use keyboard)</p>
<div class="maxcharacters" contenteditable>class="maxcharacters"</div>

<h3>max-characters on form inputs</h3>
<p>(Use keyboard)</p>
<input type=text class="maxcharacters-input" value='class="maxcharacters-input"'>
<textarea class="maxcharacters-textarea">class="maxcharacters-textarea"</textarea>

<h3>min-lines</h3>
<p>(Use keyboard)</p>
<div class="minlines" contenteditable>class="minlines"</div>

<h3>max-lines</h3>
<p>(Use keyboard)</p>
<div class="maxlines" contenteditable>class="maxlines"</div>

<h3>min-children</h3>
<button data-button="semiflat" onclick="var img=document.createElement('img');img.src='https://staticresource.s3.amazonaws.com/user.png';document.querySelector('.minchildren').appendChild(img);EQCSS.apply()">Add Child</button>
<div class="minchildren">
  <img src=https://staticresource.s3.amazonaws.com/user.png style=width:50px>
</div>

<h3>max-children</h3>
<button data-button="semiflat" onclick="var img=document.createElement('img');img.src='https://staticresource.s3.amazonaws.com/user.png';document.querySelector('.maxchildren').appendChild(img);EQCSS.apply()">Add Child</button>
<div class="maxchildren">
  <img src=https://staticresource.s3.amazonaws.com/user.png style=width:50px>
</div>

<h2>Scroll queries</h2>

<h3>min-scroll-y</h3>
<div class="min-scroll-y">
  <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
  <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>

<h3>max-scroll-y</h3>
<div class="max-scroll-y">
  <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
  <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>

<h3>min-scroll-x</h3>
<div class="min-scroll-x">
  <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>

<h3>max-scroll-x</h3>
<div class="max-scroll-x">
  <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>

<h3>Multiple Conditions</h3>
<div class="multiple-conditions" data-drag=both>class="multiple-conditions"</div>

<h2>Meta Selectors</h2>

<h3>$this</h3>
<div class="this-selector">
  <input type=text placeholder=input>
</div>

<h3>$parent</h3>
<div class="parent-selector">
  <input type=text placeholder=input>
</div>

<h3>$root</h3>
<div class="root-selector">
  <input type=text placeholder=input>
</div>

<h3>$prev</h3>
<div>
  <img src=https://staticresource.s3.amazonaws.com/user.png>
  <img class="prev-selector" src=https://staticresource.s3.amazonaws.com/user.png>
</div>

<h3>$next</h3>
<div>
  <img class="next-selector"src=https://staticresource.s3.amazonaws.com/user.png>
  <img src=https://staticresource.s3.amazonaws.com/user.png>
</div>

<h2>CSS Functions</h2>

<h3>eval("")</h3>
<div class="eval">
  <p><strong>Current Year:</strong></p>
  <p><em>Viewport Size:</em></p>
</div>
            
          
!
            
              /* Min-width in px */
@element .minwidthpixels and (min-width: 300px) {
  .minwidthpixels {
    background: greenyellow;
    border-color: limegreen;
  }
}

/* Min-width in % */
@element .minwidthpercents and (min-width: 50%) {
  .minwidthpercents {
    background: greenyellow;
    border-color: limegreen;
  }
}

/* Max-width in px */
@element .maxwidthpixels and (max-width: 300px) {
  .maxwidthpixels {
    background: greenyellow;
    border-color: limegreen;
  }
}

/* Max-width in % */
@element .maxwidthpercents and (max-width: 50%) {
  .maxwidthpercents {
    background: greenyellow;
    border-color: limegreen;
  }
}

/* Min-height in px */
@element .minheightpixels and (min-height: 200px) {
  .minheightpixels {
    background: greenyellow;
    border-color: limegreen;
  }
}

/* Min-height in % */
@element .minheightpercents and (min-height: 50%) {
  .minheightpercents {
    background: greenyellow;
    border-color: limegreen;
  }
}

/* Max-height in px  */
@element .maxheightpixels and (max-height: 200px) {
  .maxheightpixels {
    background: greenyellow;
    border-color: limegreen;
  }
}

/* Max-height in % */
@element .maxheightpercents and (max-height: 50%) {
  .maxheightpercents {
    background: greenyellow;
    border-color: limegreen;
  }
}

/* Min-characters on block elements */
@element .mincharacters and (min-characters: 35) {
  .mincharacters {
    background: greenyellow;
    border-color: limegreen;
  }
}

/* Min-characters on input */
@element .mincharacters-input and (min-characters: 35) {
  .mincharacters-input {
    background: greenyellow;
    border-color: limegreen;
  }
}

/* Min-characters on textarea */
@element .mincharacters-textarea and (min-characters: 35) {
  .mincharacters-textarea {
    background: greenyellow;
    border-color: limegreen;
  }
}

/* Max-characters */
@element .maxcharacters and (max-characters: 35) {
  .maxcharacters {
    background: greenyellow;
    border-color: limegreen;
  }
}

/* Max-characters on input */
@element .maxcharacters-input and (max-characters: 35) {
  .maxcharacters-input {
    background: greenyellow;
    border-color: limegreen;
  }
}
/* Max-characters on textarea */
@element .maxcharacters-textarea and (max-characters: 35) {
  .maxcharacters-textarea {
    background: greenyellow;
    border-color: limegreen;
  }
}

/* Min-lines */
@element .minlines and (min-lines: 5) {
  .minlines {
    background: greenyellow;
    border-color: limegreen;
  }
}

/* Max-lines */
@element .maxlines and (max-lines: 5) {
  .maxlines {
    background: greenyellow;
    border-color: limegreen;
  }
}

/* Min-children */
@element .minchildren and (min-children: 5) {
  .minchildren {
    background: greenyellow;
    border-color: limegreen;
  }
}

/* Max-children */
@element .maxchildren and (max-children: 5) {
  .maxchildren {
    background: greenyellow;
    border-color: limegreen;
  }
}

/* Min-scroll-y */
@element .min-scroll-y and (min-scroll-y: 50%) {
  .min-scroll-y {
    background: greenyellow;
    border-color: limegreen;
  }
}

/* Max-scroll-y */
@element .max-scroll-y and (max-scroll-y: 50%) {
  .max-scroll-y {
    background: greenyellow;
    border-color: limegreen;
  }
}

/* Min-scroll-x */
@element .min-scroll-x and (min-scroll-x: 50%) {
  .min-scroll-x {
    background: greenyellow;
    border-color: limegreen;
  }
}

/* Max-scroll-x */
@element .max-scroll-x and (max-scroll-x: 50%) {
    .max-scroll-x {
    background: greenyellow;
    border-color: limegreen;
  }
}

/* Multiple Conditions */
@element .multiple-conditions and (min-width: 50%) and (min-height: 150px) {
  .multiple-conditions {
    background: greenyellow;
    border-color: limegreen;
  }
}

/* $this selector */
@element .this-selector input and (min-characters: 5) {
  $this,
  $this:focus {
    background: greenyellow;
    border-color: limegreen;
  }
}

/* $parent selector */
@element .parent-selector input and (min-characters: 5) {
  $parent {
    background: greenyellow;
    border-color: limegreen;
  }
}

/* $root selector */
@element .root-selector input and (min-characters: 5) {
  $root {
    background: greenyellow;
  }
}

/* $prev selector */
@element .prev-selector {
  $prev {
    border: 2px solid limegreen;
  }
}

/* $next selector */
@element .next-selector {
  $next {
    border: 2px solid limegreen;
  }
}

/* eval('') */
@element strong {
  $this:after {
    content: ' eval("new Date().getFullYear()")';
  }
}
@element em {
  $this:after {
    content: ' eval("window.innerWidth+' x '+window.innerHeight")';
  }
}
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console