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.

            
              <div class="eqio" data-eqio-sizes='[">500", ">700"]'>
    <p>Простые выражения от элемента с помощью IntersectionObserver!</p>
  <p>Компонент меняется, когда <strong>его</strong> ширина >=500px и >=700px</p>
</div>

<div class="eqio" data-eqio-sizes='["<400", ">600", ">800"]'>
    <p>Простые выражения от элемента с помощью IntersectionObserver!</p>
    <p>Компонент меняется, когда <strong>его</strong> ширина <=400px или >=600px и >=800px</p>
</div>

<label>
  Регулируйте ширину в процентах
  <input id="width-adjuster" type="range" min="10" max="100" step="1" value="60" />
</label>
            
          
!
            
              // Элемент с eqio требует класса .eqio
// классы .eqio-[size] применяются к элементу, когда ширина подходит
.eqio {
  background: green;
  box-sizing: border-box;
  color: #fff;
  margin-bottom: 10px;
  padding: 2px;
  line-height: 1.3;
  transition: padding ease 0.15s;
  width: 80%;
  
  &::after {
    content: "Применены классы: " attr(class);
    font-family: monospace;
  }
}

// Создайте классы для каждого совпадения
.eqio-\<400 {
  background: gray;
  padding: 20px;
}
    
.eqio-\>500 {
  background: blue;
  padding: 5px;
}

.eqio-\>600 {
  background: purple;
  padding: 10px;
}
  
.eqio-\>700 {
  background: red;
  padding: 15px;
}
  
.eqio-\>800 {
  background: navy;
  padding: 20px;
}

body {
  background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA/IAAAEiCAYAAABaw+k+AAALl0lEQVR42u3dzW0USQAF4B68d5OBOe0VElgZ2QHYkICdgUlgJaRNgAzACQAOwDIZQAiQAVzNT6/eyMW2Zj1gZKiqNt8njTAzt36qqn7dPVOLcRzHAQCAOfj7kvf+cVgAfi9/OAQAALPxl0MAgCIPADAffzoEACw8Wg8AAADzccshAAAAAEUeAAAAUORvlrdv3y5f9OXVq1fDmzdv1n5GPY8fPx7ev3//v/fX5UOd8XH79m1joQOPHj26dHzQTuamzFt5PXnyxFzV6bnXs2fPHIiKXr58uRwT+Zd+1vIi60jyyZpibMyrDyryDWWwrBswed8JQLvJ7f79+5ce/+SSyY4646OURjn05c6dO8sFP0WFduMjC38ZH8ljsVh8feX/XNOXL1f+PCfCWTcODw+Xa0cKS/LZ399fvu+CiyL/O59TZVxk3ci4yCv/zzyV+Uu5ry9r93T9vnfv3tf1JO87v5pPH1TkO15o3PFqJydeOQFbHTyrkx+/Thb3aRmZTnTlbhdtZLHP2MgrJ2RKSpvxkWNfZL46ODgY8vu1Z2dnLgTXKPIra0MZF8kmpSXrSNbycuGLuuUx60S54EX70pj5qqzjWTMyV62u89Q/vyo3TMoNknzm/Go+fVCRbywDJ4v96ivvu0rZTq5O5vhfVuY/fPjgAFWQhX56Nz4TWZnM8r4c+pm/Mk6cLLcdH2XB5yf6gU19MjdNC8n0iZX8e3x87Hg2GCNljsqa7i58uxxyMWuq3PFNNu/evXOQKsvaUdaL/D1dS5KV86v59EH7yDdWHsVbN9Doo8wnozKg9vb2HJxKxz8nwOWx1FxQKY/h5e+7d+86SJUXmXInJScAyWVaIDNGPEVUd+0o46OUxdWTZa7p1tXvdeTYl69llTFhDW87PqZzVNaMjJHMYe4A1zUdGxkXJycny/OqrPF5f2try0GqLOt1xkEyyKucY+XvXGRxnjufPqjIdzDBTRcb+iuTmdwy4WVyS16u6teR452xkWOeK/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OQBAABAkQcAAAAUeQAAAECRBwAAAEUeAAAAUOQBAAAARR4AAAAUeQAAAECRBwAAAH6ixc7Og9FhAAAAgJkU+XEcFflO7O4+HE5PnzsQ8kAe8kAe8kAe8kAe8ljLo/UAAAAwI4o8AAAAKPIAAACAIg8AAACKPAAAAKDIAwAAAIo8AAAAKPIAAACAIg8AAAAo8gAAAKDIAwAAAIo8AAAAoMgDAACAIg8AAAAo8gAAAIAiDwAAAIo8AAAAoMgDAAAAijwAAAAo8gAAAIAiDwAAACjyAAAAoMgDAAAAijwAAACgyAMAAIAiDwAAACjyAAAAgCIPAAAAijwAAACgyAMAAACKPAAAACjyAAAAgCIPAAAAKPIAAACgyAMAAACKPAAAAKDIAwAAgCIPAAAAKPIAAACAIg8AAACKPAAAAKDIAwAAAIo8AAAAKPIAAACAIg8AAAAo8gAAAKDIAwAAAIo8AAAAoMgDAACAIg8AAAAo8gAAAIAiDwAAAIo8AAAAoMgDAAAAijwAAAAo8gAAAIAiDwAAACjyAAAAoMgDAAAAijwAAACgyAMAAIAiDwAAACjyAAAAgCIPAAAAijwAAACgyAMAAACKPAAAACjyAAAAgCIPAAAAKPIAAACgyAMAAACKPAAAAKDIAwAAgCIPAAAAKPIAAACAIg8AAACKPAAAAKDIAwAAAIo8AAAAKPIAAACAIg8AAAAo8gAAAKDIAwAAAIo8AAAAoMgDAACAIg8AAAAo8gAAAIAiDwAAAIo8AAAA8Cv8C2bAk85nPnriAAAAAElFTkSuQmCC');
  background-repeat: no-repeat;
  font-family: sans-serif;
  margin: 0;
  padding: 99px 0 0 0;
}

p {
  margin: 0;
}

label {
  background: rgba(palegoldenrod, 0.8);
  display: block;
  line-height: 1.7;
  position: absolute;
  top: 50px;
  width: 100%;
}

input {
  width: 40%;
}
            
          
!
            
              // Использовать eqio: https://unpkg.com/eqio/umd/eqio.min.js
// Документация: https://github.com/stowball/eqio

// Простой полифил для Array.from
Array.from = Array.from || function (object) {
  return [].slice.call(object);
};

const els = Array.from(document.getElementsByClassName('eqio'));
const eqios = [];

els.forEach((el) => {
  eqios.push(new Eqio(el));
});

document.getElementById('width-adjuster').addEventListener('input', (e) => {
  eqios.forEach((eqio) => {
    eqio.el.style.width = `${e.target.value}%`;
  });
}, false);
            
          
!
999px
Loading ..................

Console