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="container">
  <section>
  <div class="media">
      <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/4b/Windows_live_square.svg/1000px-Windows_live_square.svg.png">
  </div>
  <p class="sans xl narrow">Der Wolf hat Kreide gefressen</p><p class="m">Amerikas Präsident hat gezeigt, dass er zwei Gesichter hat: Es gibt den spalterischen Trump, der bei Auftritten kein Manuskript nutzt. Der erzählt, was ihm gerade in den Sinn kommt. Der von Punkt zu Punkt hüpft, und der vor Boshaftigkeiten seinen Gegner gegenüber nicht zurückschreckt.
Trump zeigte sich einigermaßen zahm. 
</p>
<p class="m">
Der Immobilienmogul aus New York reichte in seiner Rede den Demokraten die Hand. Sein Gesetzesvorschlag für eine neue Einwanderungspolitik sieht die Einbürgerung von 1,8 Millionen Menschen vor, mehr als jeder andere Präsident je angeboten hat. Auch will er 1,4 Billionen Dollar in die marode Infrastruktur des Landes stecken. Ob die Demokraten Trumps Hand ergreifen, scheint dennoch alles andere als ausgemacht. Darauf deuten die die versteinerten Gesichter der Demokraten während Trumps Rede im Kongress hin.<br>Das war zu erwarten
  </p>
  <p class="s">
    Sixty quick brown foxes jump over the lazy dog jump over the lazy dog<br><br>
    In the Zoo
  </p>
</section>

  <section>
  <p class="sans xxl narrow">
    Sixty quick brown foxes jump
  </p>
  <p class="sans s">
    Sixty quick brown foxes jump over the lazy dog jump over the lazy dog<br>
    In the Zoo<br>Sixty quick brown foxes jump over the lazy dog jump over the lazy dog<br>
    In the Zoo
  </p>
  <p class="sans l">
    Sixty quick brown foxes jump over the lazy dog<br>
    In the Zoo
  </p>
  <p class="sans xl">
    Sixty quick brown foxes
  </p>
  <p class="sans xxl">
    Sixty quick brown foxes
  </p>
</section>
</div>
              
            
!

CSS

              
                /* TYPO
// https://codepen.io/sebilasse/pen/BdaPzN?editors=1010
MavenPro/Georgia: https://codepen.io/sebilasse/full/oENGev
MerriweatherSans/Merriweather: https://codepen.io/sebilasse/pen/ddopBj
*/
/* 1.414 rythm for "Merriweather": 11px / 1.090909090909091 */
@import url('https://fonts.googleapis.com/css?family=Merriweather+Sans:400,700|Merriweather:400,400i,700');
:root {
  --_lineHeight: 1.090909090909091;
  --_lineREM: 1.090909090909091rem;
  --_gridColor: rgba(255, 0, 0, 0.16);
  --_size: 11px;
  font-size: var(--_size);
  line-height: var(--_lineHeight);
  box-sizing: border-box;
  
  background: -webkit-linear-gradient(var(--_gridColor), var(--_gridColor) 1px, transparent 1px);
  background: linear-gradient(var(--_gridColor), var(--_gridColor) 1px, transparent 1px);
  background-size: 1px calc(1em * var(--_lineHeight));
  background-position: 0px -1px;
}

body {
  font-family: "Merriweather", "Merriweather Sans", Serif;
  font-weight: 400;
  -webkit-font-smoothing: subpixel-antialiased;
  -webkit-font-feature-settings: 'kern' 1,'onum' 1,'liga' 1;
  -ms-font-feature-settings: 'kern' 1,'onum' 1,'liga' 1;
  -o-font-feature-settings: 'kern' 1,'onum' 1,'liga' 1;
  font-feature-settings: 'kern' 1,'onum' 1,'liga' 1;
  text-rendering: optimizeLegibility;
}
@supports (font-variant-ligatures: common-ligatures) {
  body {
    font-feature-settings: normal;
    font-variant-ligatures: common-ligatures;
  }
}

/*
RESET THE BROWSER STYLES,
only necessary here
*/
*, *:before, *:after { box-sizing: inherit; }
body, div, section, p, h1, h2, h3, h4, h5 {
  margin: 0; padding: 0;
}

.container {
  box-sizing: border-box;
  padding: 0 3vw 0 3vw;
  display: grid;
	grid-gap: 3.818181vw;
  grid-template-columns: 1fr 1fr;
}
section {
  background: rgba(0,0,0,.064);
  overflow: visible;
}
.header {
  font-variant-numeric: lining-nums;
}
.running {
  font-variant-numeric: oldstyle-nums;
}
.tabular {
  font-variant-numeric: tabular-nums;
}

.sans {
  font-family: "Merriweather Sans", "Merriweather", Sans-Serif;
}

/* 11px */
.s { 
  --size: 1;
  --lineHeight: 1.090909090909091;
  --marginBottom: 0.9090909090909092em;
  padding-top: 0.18181818181818188em;
}
/* 17px */
.m { 
  --size: 1.5454545454545454;
  --lineHeight: 1.4117647058823533;
  --marginBottom: 1.0882352941176472em;
  padding-top: 0.32352941176470607em;
}

/* 25px */
.l { 
  --size: 2.272727272727273;
  --lineHeight: 1.44;
  --marginBottom: 1.12em;
  padding-top: 0.31999999999999995em;
}

/* 37px */
.xl { 
  --size: 3.3636363636363638;
  --lineHeight: 1.2972972972972974;
  --marginBottom: 1.0405405405405406em;
  padding-top: 0.2567567567567568em;
}

/* 56px */
.xxl { 
  --size: 5.090909090909091;
  --lineHeight: 1.0714285714285716;
  --marginBottom: 0.9196428571428572em;
  padding-top: 0.15178571428571436em;
}

/* 84px */
.xxxl { 
  --size: 7.636363636363637;
  --lineHeight: 1.142857142857143;
  --marginBottom: 0.9513333333333334em;
  padding-top: 0.1964285714285715em;
}

.s, .m, .l, .xl, .xxl, .xxxl {
  font-size: calc(1rem * var(--size));
  margin-bottom: var(--marginBottom);
  line-height: var(--lineHeight);
/*  padding-top: calc((1em * var(--lineHeight)) - var(--marginBottom)); */
}
/* minimal bottom gap */
.s.narrow, .m.narrow, .l.narrow {
  margin-bottom: calc(var(--marginBottom) - (1rem * var(--_lineHeight)));
}
.xl.narrow, .xxl.narrow {
  margin-bottom: calc(var(--marginBottom) - (2rem * var(--_lineHeight)));
}
.xxxl.narrow {
  margin-bottom: calc(var(--marginBottom) - (3rem * var(--_lineHeight)));
}

.media {
  width: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}
.media img {
  object-fit: cover;
  width: 100%;
}

              
            
!

JS

              
                function makeMediaResizer() {
  var _r = window.getComputedStyle(document.documentElement);
  var size = parseInt(_r.fontSize.replace('px',''), 10);
  var lH = parseInt(_r.lineHeight.replace('px',''), 10);
  var img = document.querySelectorAll('.media img, .media video, .media audio');
  var i;
  return () => {
    for (i = 0; i < img.length; i++) {
      var h = img[i].offsetHeight;
      h = Math.floor(h / lH) * lH;
      img[i].parentNode.style.height = `${h}px`;
    }
  }
}

window.addEventListener('load', makeMediaResizer())
window.addEventListener('resize', makeMediaResizer())

              
            
!
999px

Console