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

              
                <base href="https://s3-us-west-2.amazonaws.com/s.cdpn.io/4273/">
<div id="prevnext" class="flex apart">	
	<a class="prev-one flex" href="https://thenewcode.com/1059/Responsive-Image-Hinting-Using-the-w-Descriptor" rel="prev" accesskey=",">
		<span class="thumb">
			<img src="toubana-diver.jpg" alt srcset="toubana-diver-2x.jpg 2x">
		</span>
		<span class="articlename">
			Responsive Image Hinting: Using w
		</span>
	</a>
	<a class="next-one flex" href="https://thenewcode.com/1063/Techniques-and-Treatments-for-Background-Retina-Images" rel="next" accesskey=".">
		<span class="articlename">
			Techniques and Treatments for Background Retina Images
		</span>
		<span class="thumb">
			<img src="birds-on-wire.png" alt srcset="birds-on-wire-2x.png 2x">
		</span>
	</a>
</div>

<form onsubmit="setText(event)">
  <div>
  <span>
  <label for="leftTextEntry">Left Text</label>
  <input type="text" name="leftTextEntry" id="leftTextEntry" placeholder="Responsive Image Hinting: Using w">
  </span>
  <span>
  <input type="text" name="rightTextEntry" id="rightTextEntry" placeholder="Techniques and Treatments for Background Retina Images">
    <label for="rightTextEntry">Right Text</label>
  </span>
  </div>
  <input type="submit" value="Use Text">
</form>
  
              
            
!

CSS

              
                @font-face {
		font-family: 'Libertad Book';
		src: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/4273/TipoType_-_Libertad-Book.woff') format('woff');
		font-style: normal;
		font-weight: 400;
}
* {
  box-sizing: border-box;
}

body {
  font-family: Libertad Book, Avenir, sans-serif;
  line-height: 1.6;
  color: rgba(0, 0, 0, 0.8);
}

#prevnext {
  width: 80%;
  max-width: 750px;
  margin: 0 auto;
  margin-top: 2rem;
  clear: both;
}

#prevnext a {
  font-size: smaller;
  align-items: center;
}

.apart {
  justify-content: space-between;
}

a.prev-one,
a.next-one {
  flex: 1;
}
a.next-one {
  justify-content: flex-end;
}
.flex {
  display: flex;
}

span.articlename {
  display: block;
  margin-left: 1rem;
  margin-right: 1rem;
}

a {
  text-decoration: none;
  color: inherit;
}

#prevnext a span.thumb {
  width: 125px;
  height: 125px;
}

#prevnext a span.thumb img {
  border-radius: 50%;
  overflow: hidden;
  width: 125px;
  min-width: 125px;
  height: 100%;
  border: 1px solid #ccc;
}

a.prev-one span.articlename:before {
  content: "\2190 ";
}

a.next-one span.articlename:after {
  content: " \2192";
}
form {
  max-width: 800px;
  margin: 3rem auto;
  text-align: center;
}
form div {
  display: flex;
  justify-content: space-between;
}
form span, form span * { 
  display: inline-block;
}
form span * {
  padding: .5rem;
}
form input[type="text"] {
  width: 15rem;
}
form input[type="submit"] {
  font-size: 1rem;
  display: inline-block;
  padding: .5rem;
  background: #000;
  color: #fff;
}
              
            
!

JS

              
                function matchHeight() {
	var difference = leftText.offsetHeight - rightText.offsetHeight;
	if (difference > 0) { // left is taller than right
		rightText.style.marginTop = "-" + difference+"px";
	}
  if (difference < 0) { // right is taller than left
  		leftText.style.marginTop = difference +"px"; 
  }
  if (difference == 0 && (leftText.hasAttribute("style") || rightText.hasAttribute("style"))) { 	    
    leftText.removeAttribute("style");            
    rightText.removeAttribute("style");
  }
}

function setText(event) {
  event.preventDefault();
  if (leftTextEntry.value !== "") {
    leftText.innerHTML = leftTextEntry.value;
  } else {
    leftText.innerHTML = leftTextEntry.placeholder;
  }
  if (rightTextEntry.value !== "") {
    rightText.innerHTML = rightTextEntry.value;
  } else {
    rightText.innerHTML = rightTextEntry.placeholder;
  }
  matchHeight();
}
var leftText = document.querySelector("#prevnext a span.articlename"),
rightText = document.querySelector("#prevnext a:last-child span.articlename"),
leftTextEntry = document.getElementById("leftTextEntry"),
rightTextEntry = document.getElementById("rightTextEntry");

$(window).bind("load", function() {
   matchHeight();
});

window.addEventListener("resize", function() {
		window.requestAnimationFrame(matchHeight);
});

              
            
!
999px

Console