Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="container">

  <section class="demo">
    <h1>Π­Π»Π΅ΠΌΠ΅Π½Ρ‚Ρ‹ Ρ„ΠΎΡ€ΠΌΡ‹ Π² Π³Ρ€ΠΈΠ΄Π΅</h1>
    
    <!-- Π΄Π²Π° изобраТСния -->
<!--     <div class="grid">
      <img src="http://fillmurray.com/400/300">
      <img src="http://fillmurray.com/400/300">
    </div>
 -->
    <!-- два поля number -->
    <div class="grid">
      <input type="number">
      <input type="number">
    </div>

    <!-- Π΄Π²Π° элСмСнта progress -->
    <div class="grid">
      <progress></progress>
      <progress></progress>
    </div>

    <!-- Π΄Π²Π° пустых поля -->
    <div class="grid">
      <input>
      <input>
    </div>
    <!-- Π΄Π²Π° ΠΊΠΎΡ€ΠΎΡ‚ΠΊΠΈΡ… бокса сСлСкта -->
    <div class="grid">
      <select><option>Foo</option></select>
      <select><option>Bar</option></select>
    </div>
    <!-- Π΄Π²Π° Π΄Π»ΠΈΠ½Π½Ρ‹Ρ… бокса сСлСкта -->
    <div class="grid">
      <select><option>это Ρ€Π΅Π°Π»ΡŒΠ½Π°Ρ ΡˆΠΈΡ€ΠΈΠ½Π° бокса сСлСкта</option></select>
      <select><option>это Ρ€Π΅Π°Π»ΡŒΠ½Π°Ρ ΡˆΠΈΡ€ΠΈΠ½Π° бокса сСлСкта</option></select>
    </div>
    <!-- поля Π²Π½ΡƒΡ‚Ρ€ΠΈ div -->
    <div class="grid">
      <div><input></div>
      <div><input></div>
    </div>
    <!-- сСлСкты Π²Π½ΡƒΡ‚Ρ€ΠΈ div -->
    <div class="grid">
      <div><select><option>это Ρ€Π΅Π°Π»ΡŒΠ½Π°Ρ ΡˆΠΈΡ€ΠΈΠ½Π° бокса сСлСкта</option></select></div>
      <div><select><option>это Ρ€Π΅Π°Π»ΡŒΠ½Π°Ρ ΡˆΠΈΡ€ΠΈΠ½Π° бокса сСлСкта</option></select></div>
    </div>

    <!-- поля с Ρ‚ΠΈΠΏΠΎΠΌ file -->
    <div class="grid">
      <input type="file">
      <input type="file">
    </div>
    <!-- ΠΊΠ½ΠΎΠΏΠΊΠΈ submit -->
    <div class="grid">
      <input type="submit">
      <input type="submit">
    </div>
    <!-- поля reset -->
    <div class="grid">
      <input type="reset">
      <input type="reset">
    </div>
    <!-- ΠΊΠΎΡ€ΠΎΡ‚ΠΊΠΈΠ΅ ΠΊΠ½ΠΎΠΏΠΊΠΈ -->
    <div class="grid">
      <button>ΠŸΡ€ΠΈΠ²Π΅Ρ‚ΠΈΠΊ</button>
      <button>ΠŸΡ€ΠΈΠ²Π΅Ρ‚ΠΈΠΊ</button>
    </div>

    <!-- Π΄Π»ΠΈΠ½Π½Ρ‹Π΅ ΠΊΠ½ΠΎΠΏΠΊΠΈ -->
    <div class="grid">
      <button>ΠŸΡ€ΠΈΠ²Π΅Ρ‚ΠΈΠΊ, ΠΏΡ€ΠΈΡΡ‚Π΅Π»ΡŒ, ΠΊΠ°ΠΊ Π΄Π΅Π»Π°?</button>
      <button>ΠŸΡ€ΠΈΠ²Π΅Ρ‚ΠΈΠΊ, ΠΏΡ€ΠΈΡΡ‚Π΅Π»ΡŒ, ΠΊΠ°ΠΊ Π΄Π΅Π»Π°?</button>
    </div>
    <!-- ΠΊΠ½ΠΎΠΏΠΊΠΈ Π²Π½ΡƒΡ‚Ρ€ΠΈ div-ΠΎΠ² -->
    <div class="grid">
      <div><button>ΠŸΡ€ΠΈΠ²Π΅Ρ‚ΠΈΠΊ, ΠΏΡ€ΠΈΡΡ‚Π΅Π»ΡŒ, ΠΊΠ°ΠΊ Π΄Π΅Π»Π°?</button></div>
      <div><button>ΠŸΡ€ΠΈΠ²Π΅Ρ‚ΠΈΠΊ, ΠΏΡ€ΠΈΡΡ‚Π΅Π»ΡŒ, ΠΊΠ°ΠΊ Π΄Π΅Π»Π°?</button></div>
    </div>

  </section>
 
  <header>
    <p>БСгодня я ΡƒΠ·Π½Π°Π», Ρ‡Ρ‚ΠΎ ΠΈΠ·-Π·Π° элСмСнтов <code>input</code> Π² Π³Ρ€ΠΈΠ΄Π°Ρ… ΠΎΠ½ΠΈ пСрСстанут Π±Ρ‹Ρ‚ΡŒ Π°Π΄Π°ΠΏΡ‚ΠΈΠ²Π½Ρ‹ΠΌΠΈ. Π­Ρ‚ΠΎ ΠΌΠΎΠΆΠ½ΠΎ ΠΏΠΎΡ„ΠΈΠΊΡΠΈΡ‚ΡŒ Π² Chrome, ΡƒΠ΄Π°Π»ΠΈΠ² min-width (ΠΊΠΎΡ‚ΠΎΡ€Ρ‹ΠΉ Π²ΠΈΠ΄ΠΈΠΌΠΎ Π½Π΅ ΡƒΠΊΠ°Π·Π°Π½ Π² ΠΎΡ‚Π»Π°Π΄Ρ‡ΠΈΠΊΠ΅). ВСкст/изобраТСния ΡΠΆΠΈΠΌΠ°ΡŽΡ‚ΡΡ ΠΊΠ°ΠΊ ΠΈ оТидалось. Π˜Π½ΡΡ‚Ρ€ΡƒΠΊΡ†ΠΈΡ:
</p>

    <ul>
      <li>ΠŸΠΎΠΈΠ·ΠΌΠ΅Π½ΡΠΉΡ‚Π΅ Ρ€Π°Π·ΠΌΠ΅Ρ€ ΠΎΠΊΠ½Π° Π΄ΠΎ появлСния Π³ΠΎΡ€ΠΈΠ·ΠΎΠ½Ρ‚Π°Π»ΡŒΠ½ΠΎΠ³ΠΎ скроллбара.</li>
      <li><strong>ОТиданиС:</strong> Π½Π΅Ρ‚ Π³ΠΎΡ€ΠΈΠ·ΠΎΠ½Ρ‚Π°Π»ΡŒΠ½ΠΎΠ³ΠΎ скролла, ΠΊΠΎΠ½Ρ‚Π΅Π½Ρ‚ ΠΏΡ€ΠΎΠ΄ΠΎΠ»ΠΆΠ°Π΅Ρ‚ ΡΠΆΠΈΠΌΠ°Ρ‚ΡŒΡΡ.</li>
      <li><strong>Π Π΅Π°Π»ΡŒΠ½ΠΎΡΡ‚ΡŒ:</strong> поля ΠΏΠ΅Ρ€Π΅ΡΡ‚Π°ΡŽΡ‚ ΡΠΆΠΈΠΌΠ°Ρ‚ΡŒΡΡ ΠΈ появляСтся Π³ΠΎΡ€ΠΈΠ·ΠΎΠ½Ρ‚Π°Π»ΡŒΠ½Π°Ρ полоса ΠΏΡ€ΠΎΠΊΡ€ΡƒΡ‚ΠΊΠΈ

    </ul>
    <p>Π¨Π°Π³ 1: Π£Π΄Π°Π»ΠΈΡ‚ΡŒ `min-width: auto` ΠΈΠ· элСмСнтов Π³Ρ€ΠΈΠ΄Π°. </p>
    <button id="removeMinWidth">ΠŸΡ€ΠΈΠΌΠ΅Π½ΡΠ΅ΠΌ ΠΊ Π½ΠΈΠΌ min-width: 0.</button>
    <p>Π¨Π°Π³ 2: ДобавляСм max-width.</p>
    <button id="addMaxWidth">
ДобавляСм max-width ΠΊ ΠΊΠΎΠ½Ρ‚Ρ€ΠΎΠ»Π°ΠΌ Ρ„ΠΎΡ€ΠΌΡ‹.
</button>
    <p>Π¨Π°Π³ 3: ЗаставляСм поля с Ρ‚ΠΈΠΏΠΎΠΌ file ΠΈ submit ΠΏΠ΅Ρ€Π΅Π½ΠΎΡΠΈΡ‚ΡŒ тСкст</p>
    <button id="wrapText">ЗаставляСм поля ΠΏΠ΅Ρ€Π΅Π½ΠΎΡΠΈΡ‚ΡŒ тСкст</button>
    <p>Π¨Π°Π³ 4: Π—Π°Π΄Π°Ρ‘ΠΌ range, number, ΠΈ progress ΠΏΠΎΠ»Π½ΡƒΡŽ ΡˆΠΈΡ€ΠΈΠ½Ρƒ: </p>
    <button id="width100">Π—Π°Π΄Π°Ρ‘ΠΌ этим Ρ‚ΠΈΠΏΠ°ΠΌ ΠΊΠΎΠ½Ρ‚Ρ€ΠΎΠ»ΠΎΠ² max-width
</button>
    <p>Если ΡΠ΄Π΅Π»Π°Ρ‚ΡŒ Π΅Ρ‰Ρ‘ ΠΎΠ΄ΠΈΠ½ шаг ΠΈ Π·Π°Π΄Π°Ρ‚ΡŒ ΡˆΠΈΡ€ΠΈΠ½Π°ΠΌ input/select `width: 100%`, Ρ‚ΠΎ шаги 1 ΠΈ 2 Π½Π΅ понадобятся. Но шаг 1 исправляСт Π΅Ρ‰Ρ‘ ΠΎΠ΄Π½Ρƒ ΠΏΡ€ΠΎΠ±Π»Π΅ΠΌΡƒ (`overflow-x` Π½Π° элСмСнтах), Π° шаг 2 каТСтся Ρ€Π°Π·ΡƒΠΌΠ½Ρ‹ΠΌ Π·Π½Π°Ρ‡Π΅Π½ΠΈΠ΅ΠΌ ΠΏΠΎ ΡƒΠΌΠΎΠ»Ρ‡Π°Π½ΠΈΡŽ.
</p>
  </header>
</div>
              
            
!

CSS

              
                // РСсСт
* {
  box-sizing: border-box;
}

header {
  background: #fee;
  padding: 1em;
  margin-bottom: 2em;
}

.container {
  padding: 2em;
  max-width: 1234px;
  margin: 0 auto;
}

button.active {
  background: green;
  color: white;
}


.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-gap: 2em;
  margin-bottom: 1em;
}

body.removeMinWidth {
  // &:before {
  //   content: '.grid > * { min-width: 0; }';
  //   position: fixed;
  //   background: red;
  //   top: 0;
  // }
  .grid > * {
    min-width: 0;
  }
}


body.addMaxWidth {
  img,
  video,
  audio,
  canvas,
  input,
  select,
  button,
  progress {
    max-width: 100%;
  }
}


body.wrapText {

  input { 
      white-space: pre-wrap;
  }

}


body.width100 {

  input[type="range"],
  progress { 
      width: 100%;
  }
  
  @supports (--moz-appearance: none) {
    input[type="number"] { width: 100%; }
  }
  // ΠŸΠ΅Ρ€Π΅ΠΎΠΏΡ€Π΅Π΄Π΅Π»Π΅Π½ΠΈΠ΅ β€œΠ²Π½ΡƒΡ‚Ρ€Π΅Π½Π½ΠΈΡ… размСров” Π·Π°ΠΌΠ΅Ρ‰Π°Π΅ΠΌΡ‹Ρ… элСмСнтов.

}
              
            
!

JS

              
                document.querySelector('button#removeMinWidth').addEventListener('click', function( event ){
  event.preventDefault();
  document.body.classList.toggle('removeMinWidth');  
    this.classList.toggle('active');

});


document.querySelector('button#addMaxWidth').addEventListener('click', function( event ){
  event.preventDefault();
  document.body.classList.toggle('addMaxWidth');
    this.classList.toggle('active');

})


document.querySelector('button#wrapText').addEventListener('click', function( event ){
  event.preventDefault();
  document.body.classList.toggle('wrapText');
  this.classList.toggle('active');
})


document.querySelector('button#width100').addEventListener('click', function( event ){
  event.preventDefault();
  document.body.classList.toggle('width100');
    this.classList.toggle('active');

})

              
            
!
999px

Console