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 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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console