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 CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

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.

            
              
<section class="what?">
	<h2>What is this?</h2>
	<p>Each of these containers has fluid typography with different easing techniques applied. Although they all have the same minimum and maximum sizes the transitions will be subtly different. <strong>Resize this window to see.</strong></p>
	
	<P>If you just want to <a target="_blank" href="https://www.sassmeister.com/gist/beac01f68da4f9ef3007c0d17f72d8c6">grab the mixin you can find it here</a>.</p>
	
	<P>If you want to read more about why I made this read <a target="_blank"  href="https://madebymike.com.au/writing/interpolation-without-animation/">Interpolation without animation</a>
and <a target="_blank" href="https://madebymike.com.au/writing/non-linear-interpolation-in-css/">Non-linear interpolation in CSS</a>.
		</p>
</section>

<section class="classic-linear">
	<h2>Classic Linear</h2>
	<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sint nisi, adipisci libero vitae deserunt iusto facilis expedita placeat quisquam fugit eligendi ipsum illum distinctio qui unde incidunt iure exercitationem voluptatem.</p>
	<pre>
.classic-linear {
  @include interpolate('font-size', 600px, 12px, 900px, 24px);
}</pre>
<span class="logger"></span> 
</section>	

<section class="easy-peasy">
	<h2>Easy Peasy</h2>
	<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sint nisi, adipisci libero vitae deserunt iusto facilis expedita placeat quisquam fugit eligendi ipsum illum distinctio qui unde incidunt iure exercitationem voluptatem.</p>
		<pre>
.easy-peasy {
  @include interpolate('font-size', 600px, 12px, 900px, 24px, 'ease-in');
}</pre>
<span class="logger"></span>
</section>	


<section class="cubic-bezier">
	<h2>Cubic Bezier</h2>
	<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sint nisi, adipisci libero vitae deserunt iusto facilis expedita placeat quisquam fugit eligendi ipsum illum distinctio qui unde incidunt iure exercitationem voluptatem.</p>
		<pre>
.cubic-bezier {
  @include interpolate('font-size', 600px, 12px, 900px, 24px, 'cubic-bezier(0.42, 0, 1, 1)');
}</pre>
<span class="logger"></span>
</section>	

<section class="bloat-my-css">
	<h2>Bloat My CSS</h2>
	<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sint nisi, adipisci libero vitae deserunt iusto facilis expedita placeat quisquam fugit eligendi ipsum illum distinctio qui unde incidunt iure exercitationem voluptatem.</p>
		<pre>
.bloat-my-css {
  @include interpolate('font-size', 600px, 12px, 900px, 24px, 'ease-in-ease-out', 6);
}</pre>
<span class="logger"></span>
</section>
            
          
!
            
              // interpolate()

// This mixin generates CSS for interpolation of length properties.
// It has 5 required parameters, including the target property, initial
// screen size, initial value, final screen size and final value.

// It has two optional parameters which include an easing property, 
// which is a string representation of a CSS animation-timing-function, 
// and finally a number of bending-points that determines how many 
// interpolations steps are applied along the easing function.

///
/// @param {String} $property - The CSS property to interpolate
/// @param {Unit} $min-screen - A CSS length unit
/// @param {Unit} $min-value - A CSS length unit
/// @param {Unit} $max-screen - Value to be parsed
/// @param {Unit} $max-value - Value to be parsed
/// @param {String} $easing - Value to be parsed
/// @param {Number} $bending-points - Value to be parsed
///


/// EXAMPLES

.classic-linear {
	@include interpolate('font-size', 600px, 12px, 1000px, 24px); 
}
.easy-peasy {
	@include interpolate('font-size', 600px, 12px, 1000px, 24px, 'ease-in');
}
.cubic-bezier {
	@include interpolate('font-size', 600px, 12px, 1000px, 24px, 'cubic-bezier(0.75, 0.05, 0.85, 0.06)');
}
.bloat-my-css {
	@include interpolate('font-size', 600px, 12px, 1000px, 24px, 'ease-in-ease-out', 10); 
}


// Just for presentation, these styles do not relate to this technique

html {
	font-family: 'Muli', sans-serif;
	background: hsl(100, 50%, 95%);
}

@media screen and (min-width: 600px) {
	html{background: hsl(55, 50%, 95%);}
}

@media screen and (min-width: 1000px) {
	html{background: hsl(0, 50%, 95%);}
}

h2 {
	margin-top: 0;
}

section {
	padding: .75rem 1rem;
	margin: 1rem;
}

.classic-linear {
	background: hsl(90, 70%, 90%);
	border: solid 5px hsla(90, 70%, 50%, 0.25);
}
.easy-peasy {
	background: hsl(200, 70%, 90%);
	border: solid 5px hsla(200, 70%, 50%, 0.25);
}
.cubic-bezier {
	background: hsl(25, 70%, 90%);
	border: solid 5px hsla(25, 70%, 50%, 0.25);
}
.bloat-my-css {
	background: hsl(240, 70%, 90%);
	border: solid 5px hsla(240, 70%, 50%, 0.25);
}

pre {
	background: #eaeaea;
	padding: .5em;
	border: solid 1px #999;
	font-size: 16px;
	display: none;
}

@media screen and (min-width: 1000px) {
	pre {
		display: block;
	}	
}

section {position: relative;}
.logger { 
	position: absolute;
	text-align: right;
	right: 0;
	bottom: 0;
	background: rgba(0,0,0,0.55);
	color: white;
	padding: 1px 3px;
	font-size: 10px;
}
.logger:empty {
	display: none;
}
            
          
!
            
              // Some very hacky JS to display the pixel values

(function() {
	var throttle = function(type, name, obj) {
		obj = obj || window;
		var running = false;
		var func = function() {
			if (running) { return; }
			running = true;
			requestAnimationFrame(function() {
				obj.dispatchEvent(new CustomEvent(name));
				running = false;
			});
		};
		obj.addEventListener(type, func);
	};

	/* init - you can init any event */
	throttle("resize", "optimizedResize");
})();

// handle event
var LogValues = function() {
	var root = document.documentElement;
	var sections = document.querySelectorAll('section')
	var viewportWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);	

	for (var i = 0; i < sections.length; i++) {
		var logger = sections[i].querySelector('.logger');
		if(logger){
			var style = window.getComputedStyle(sections[i], null);
			var fontSize = style.getPropertyValue("font-size");
			logger.innerHTML = 'font-size: ' + (Math.round(parseFloat(fontSize,10) * 100) / 100) + 'px';	
		}
	}
}

LogValues();
window.addEventListener("optimizedResize", LogValues);

            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console