Pen Settings

HTML

CSS

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

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

Behavior

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.

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="mondrian">
      <ul class="w3-center">
        <li class="iw3 ih2"><img alt="" class="pw3 ph2" src="https://elnet.ch/sites/elnet.ch/files/inline-images/mondrian/3x2%20Color%20One%20gelb.jpg" /></li>
        <li class="iw2 ih1"><img alt="" class="pw2 ph1" src="https://elnet.ch/sites/elnet.ch/files/inline-images/mondrian/2x1%20Mat%20pistazien%20gr%C3%BCn.jpg" /></li>
        <li class="iw4 ih1"><img alt="" class="pw4 ph1" src="https://elnet.ch/sites/elnet.ch/files/inline-images/mondrian/4x1%20Elegance%20Pergamon.jpg" /></li>
        <li class="iw1 ih1"><img alt="" class="pw1 ph1" src="https://elnet.ch/sites/elnet.ch/files/inline-images/mondrian/1x1%20Elegance%20Pergamon.jpg" /></li>
        <li class="iw4 ih4"><img alt="" class="pw4 ph4" src="https://elnet.ch/sites/elnet.ch/files/inline-images/mondrian/4x4%20Marmor%20Nero%20Marquinia.jpg" /></li>
        <li class="iw2 ih1"><img alt="" class="pw2 ph1" src="https://elnet.ch/sites/elnet.ch/files/inline-images/mondrian/2x1%20Color%20One%20rot.jpg" /></li>
        <li class="iw2 ih2"><img alt="" class="pw2 ph2" src="https://elnet.ch/sites/elnet.ch/files/inline-images/mondrian/2x2%20Color%20One%20rot.jpg" /></li>
        <li class="iw2 ih1"><img alt="" class="pw2 ph1" src="https://elnet.ch/sites/elnet.ch/files/inline-images/mondrian/2x1%20Ardesia%20schwarz.jpg" /></li>
        <li class="iw1 ih1"><img alt="" class="pw1 ph1" src="https://elnet.ch/sites/elnet.ch/files/inline-images/mondrian/1x1%20Glossy%20kobalt%20blau.jpg" /></li>
        <li class="iw3 ih3"><img alt="" class="pw3 ph3" src="https://elnet.ch/sites/elnet.ch/files/inline-images/mondrian/3x3%20Casablanca.jpg" /></li>
        <li class="iw1 ih3"><img alt="" class="pw1 ph3" src="https://elnet.ch/sites/elnet.ch/files/inline-images/mondrian/1x3%20Elegance%20Pergamon.jpg" /></li>
        <li class="iw2 ih2"><img alt="" class="pw2 ph2" src="https://elnet.ch/sites/elnet.ch/files/inline-images/mondrian/2x2%20Glossy%20kobalt%20blau.jpg" /></li>
        <li class="iw4 ih2"><img alt="" class="pw4 ph2" src="https://elnet.ch/sites/elnet.ch/files/inline-images/mondrian/4x2%20Discovery%20Colonial.jpg" /></li>
        <li class="iw3 ih1"><img alt="" class="pw3 ph1" src="https://elnet.ch/sites/elnet.ch/files/inline-images/mondrian/3x1%20Casablanca.jpg" /></li>
        <li class="iw1 ih1"><img alt="" class="pw1 ph1" src="https://elnet.ch/sites/elnet.ch/files/inline-images/mondrian/1x1%20Glossy%20orange.jpg" /></li>
        <li class="iw1 ih4"><img alt="" class="pw1 ph4" src="https://elnet.ch/sites/elnet.ch/files/inline-images/mondrian/1x4%20Mat%20hellblau.jpg" /></li>
        <li class="iw1 ih3"><img alt="" class="pw1 ph3" src="https://elnet.ch/sites/elnet.ch/files/inline-images/mondrian/1x3%20gr%C3%BCn%20gl%C3%A4nzend.jpg" /></li>
        <li class="iw1 ih2"><img alt="" class="pw1 ph2" src="https://elnet.ch/sites/elnet.ch/files/inline-images/mondrian/1x2%20Color%20One%20rot.jpg" /></li>
        <li class="iw4 ih4"><img alt="" class="pw4 ph4" src="https://elnet.ch/sites/elnet.ch/files/inline-images/mondrian/4x4%20Treviso%20coral%20rot.jpg" /></li>
        <li class="iw1 ih2"><img alt="" class="pw1 ph2" src="https://elnet.ch/sites/elnet.ch/files/inline-images/mondrian/1x2%20Mat%20pistazie%20gr%C3%BCn.jpg" /></li>
        <li class="iw1 ih1"><img alt="" class="pw1 ph1" src="https://elnet.ch/sites/elnet.ch/files/inline-images/mondrian/1x1%20Vivid%20Colours%20lila.jpg" /></li>
        <li class="iw2 ih3"><img alt="" class="pw2 ph3" src="https://elnet.ch/sites/elnet.ch/files/inline-images/mondrian/2x3%20Glossy%20gr%C3%BCn.jpg" /></li>
        <li class="iw1 ih3"><img alt="" class="pw1 ph3" src="https://elnet.ch/sites/elnet.ch/files/inline-images/mondrian/1x3%20Ardesia%20schwarz.jpg" /></li>
        <li class="iw1 ih4"><img alt="" class="pw1 ph4" src="https://elnet.ch/sites/elnet.ch/files/inline-images/mondrian/1x4%20Elegance%20Pergamon%20-%20Kopie.jpg" /></li>
        <li class="iw2 ih2"><img alt="" class="pw2 ph2" src="https://elnet.ch/sites/elnet.ch/files/inline-images/mondrian/2x2%20Ardesia%20schwarz.jpg" /></li>
        <li class="iw2 ih4"><img alt="" class="pw2 ph4" src="https://elnet.ch/sites/elnet.ch/files/inline-images/mondrian/2x4%20Marmor%20Thassos%20weiss.jpg" /></li>
        <li class="iw2 ih3"><img alt="" class="pw2 ph3" src="https://elnet.ch/sites/elnet.ch/files/inline-images/mondrian/2x3%20Sahara%20grau.jpg" /></li>
        <li class="iw3 ih2"><img alt="" class="pw3 ph2" src="https://elnet.ch/sites/elnet.ch/files/inline-images/mondrian/3x2%20Marmo%20Travertino%20Chiaro%20geb%C3%BCrstet%20beige.jpg" /></li>
        <li class="iw1 ih3"><img alt="" class="pw1 ph3" src="https://elnet.ch/sites/elnet.ch/files/inline-images/mondrian/1x3%20Casablanca.jpg" /></li>
        <li class="iw6 ih1"><img alt="" class="pw6 ph1" src="https://elnet.ch/sites/elnet.ch/files/inline-images/mondrian/6x1%20Elegance%20Pergamon.jpg" /></li>
        <li class="iw2 ih2"><img alt="" class="pw2 ph2" src="https://elnet.ch/sites/elnet.ch/files/inline-images/mondrian/4x4%20Marmo%20Travertino%20chiaro%20beige.jpg" /></li>
        <li class="iw2 ih1"><img alt="" class="pw2 ph1" src="https://elnet.ch/sites/elnet.ch/files/inline-images/mondrian/Marmo%20Travertino%20Chiaro%20geb%C3%BCrstet%20beige.jpg" /></li>
        <li class="iw1 ih1"><img alt="" class="pw1 ph1" src="https://elnet.ch/sites/elnet.ch/files/inline-images/mondrian/gr%C3%BCn%20gl%C3%A4nzend.jpg" /></li>
        <li class="iw2 ih1"><img alt="" class="pw2 ph1" src="https://elnet.ch/sites/elnet.ch/files/inline-images/mondrian/Migmatit%20Multicolour.jpg" /></li>
        <li class="iw1 ih1"><img alt="" class="pw1 ph1" src="https://elnet.ch/sites/elnet.ch/files/inline-images/mondrian/Color%20One%20gelb.jpg" /></li>
        <li class="iw1 ih1"><img alt="" class="pw1 ph1" src="https://elnet.ch/sites/elnet.ch/files/inline-images/mondrian/Marmo%20Rosso%20Verona%20antique%20rot.jpg" /></li>
        <li class="iw1 ih1"><img alt="" class="pw1 ph1" src="https://elnet.ch/sites/elnet.ch/files/inline-images/mondrian/Regent%20grau.jpg" /></li>
        <li class="iw1 ih1"><img alt="" class="pw1 ph1" src="https://elnet.ch/sites/elnet.ch/files/inline-images/mondrian/Glossy%20rosa.jpg" /></li>
        <li class="iw1 ih1"><img alt="" class="pw1 ph1" src="https://elnet.ch/sites/elnet.ch/files/inline-images/mondrian/Glossy%20gr%C3%BCn.jpg" /></li>
      </ul>
    </div>
              
            
!

CSS

              
                :root {
  --base_size: 80px;
}
@media (max-width:700px){
  :root {
    --base_size: 60px;
  }
}
@media (max-width:500px){
  :root {
    --base_size: 45px;
  }
}
@media (max-width:300px){
  :root {
    --base_size: 35px;
  }
}

body {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  background-color: #ffffff;
  font-family: Helvetica, Calibri, sans-serif;
  padding: 50px;
  text-align: center;
  font-size: 16px;
}

h1 {
  color: #333;
  font-size: 20px;
  font-weight: bold;
}  

.mondrian {
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  border: 1em solid black;
  justify-content: center;
  background-color: black;
  border-radius: 1em;
}

.mondrian * {
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}
.mondrian img {
  background-color: black;
  padding: .5em;
  display: block;
  border-radius: 1em;
}
.mondrian ul, .mondrian li {
  margin: 0;
  padding: 0;
  list-style: none;
}
.mondrian ul {
  display: grid;
  grid-gap: 0;
  grid-template-columns: repeat(auto-fill, minmax(var(--base_size), var(--base_size)));
  grid-auto-columns: var(--base_size);
  grid-auto-rows: var(--base_size);
  grid-auto-flow: dense;
  list-style-type: none;
  list-style-position: inside;
  align-items: center;
  justify-content: center;
}
.ih2 {
  grid-row: span 2;
}
.iw2 {
  grid-column: span 2;
}
.ih3 {
  grid-row: span 3;
}
.iw3 {
  grid-column: span 3;
}
.ih4 {
  grid-row: span 4;
}
.iw4 {
  grid-column: span 4;
}
.ih6 {
  grid-row: span 6;
}
.iw6 {
  grid-column: span 6;
}
.pw1 {
  width: var(--base_size);
}
.ph1 {
  height: var(--base_size);
}
.pw2 {
  width: calc(var(--base_size) * 2);
}
.ph2 {
  height: calc(var(--base_size) * 2);
}
.pw3 {
  width: calc(var(--base_size) * 3);
}
.ph3 {
  height: calc(var(--base_size) * 3);
}
.pw4 {
  width: calc(var(--base_size) * 4);
}
.ph4 {
  height: calc(var(--base_size) * 4);
}
.pw6 {
  width: calc(var(--base_size) * 6);
}
.ph6 {
  height: calc(var(--base_size) * 6);
}
              
            
!

JS

              
                
              
            
!
999px

Console