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 includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

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

              
                
              
            
!

CSS

              
                /*
DESIGNER? Check this out instead: https://codepen.io/smlsvnssn/full/LYWaVLr

Mixin: proportionalFont

Removes the inconvenience of having an unpredictable box around all html text, and lets you adjust distances between boxes based on x-height (or cap-height, if you prefer it that way) and baseline, rather than guessing. Use padding, not margin, to adjust distances between text boxes (Margin-top can be used, but margin-bottom is set by the mixin). 

Input:
$fontSize - with css-unit (any unit works).
$lineHeight - without css-unit, as a ratio of $font-size (like em).
$fontSpecs - an scss-map with font-specific values adjusted manually (Kind of a font-family deluxe). Use this tool to adjust: https://codepen.io/smlsvnssn/full/LYWaVLr

Example:

$libreFranklin: (
	'font': ('Libre Franklin', sans-serif),
	'topToXheightRatio': .34,
	'lineheightMinusXheightRatio': .47,
	'leftShiftRatio': .1,
	'letterSpacingRatio': -.05
);

h1 {
	@include proportionalFont( 5rem, 1, $libreFranklin );
}

Or:

@mixin sans($fontSize: 1rem, $lineHeight: 1){
	$fontSpecs: (
		'font': ('DM Sans', sans-serif),
		'topToXheightRatio': .34,
		'lineheightMinusXheightRatio': .50,
		'leftShiftRatio': .08,
		'letterSpacingRatio': -.03
	);
	@include proportionalFont($fontSize, $lineHeight, $fontSpecs);
}

h1 {
	@include sans(5rem);
}
*/

@mixin proportionalFont(
	// Any unit
	$fontSize: 1em,
	// Has to be unitless (like em)
	$lineHeight: 1,
	
	$fontSpecs: (
		// Font-family (parentheses if list with fallbacks)
		'font': sans-serif, 
		// Distance between top of box at lineheight 1 and the x-height. Sets negative translateY.
		'topToXheightRatio': .32, 
		// Relationship between height of box at lineheight 1 and x-height. Sets negative margin-bottom.
		'lineheightMinusXheightRatio': .64,
		// Adjusts left edge, as ratio of font-size.
		'leftShiftRatio': 0,
		// Sets letter-spacing, in em.
		'letterSpacingRatio': -0.04
		)
	)
{
	font: $fontSize#{"/"}$lineHeight map-get($fontSpecs, 'font');
	letter-spacing: 0em + map-get($fontSpecs, 'letterSpacingRatio');
	transform:
		translatey(-$fontSize * ((($lineHeight - 1)/2) + map-get($fontSpecs, 'topToXheightRatio')))			
		translatex(-$fontSize * map-get($fontSpecs, 'leftShiftRatio')); 
	margin-bottom: -$fontSize * (($lineHeight - 1) + map-get($fontSpecs, 'lineheightMinusXheightRatio'));
}

@mixin sans($fontSize: 1rem, $lineHeight: 1){
	$fontSpecs: (
		'font': ('DM Sans', sans-serif),
		'topToXheightRatio': .34,
		'lineheightMinusXheightRatio': .50,
		'leftShiftRatio': .08,
		'letterSpacingRatio': -.03
	);
	@include proportionalFont($fontSize, $lineHeight, $fontSpecs);
}

@mixin display($fontSize: 1rem, $lineHeight: 1){
	$fontSpecs: (
		'font': ('DM Serif Display', serif),
		'topToXheightRatio': .365,
		'lineheightMinusXheightRatio': .515,
		'leftShiftRatio': .07,
		'letterSpacingRatio': -.01
	);
	@include proportionalFont($fontSize, $lineHeight, $fontSpecs);
}

@mixin text($fontSize: 1rem, $lineHeight: 1){
	$fontSpecs: (
		'font': ('DM Serif Text', serif),
		'topToXheightRatio': .37,
		'lineheightMinusXheightRatio': .52,
		'leftShiftRatio': .08,
		'letterSpacingRatio': -.02
	);
	@include proportionalFont($fontSize, $lineHeight, $fontSpecs);
}

@mixin serif($fontSize: 1rem, $lineHeight: 1){
	$fontSpecs: (
		'font': ('Manuale', serif),
		'topToXheightRatio': .38,
		'lineheightMinusXheightRatio': .51,
		'leftShiftRatio': .12
	);
	@include proportionalFont($fontSize, $lineHeight, $fontSpecs);
}

@mixin mono($fontSize: 1rem, $lineHeight: 1){
	$fontSpecs: (
		'font': ('DM Mono', monospace),
		'topToXheightRatio': .375,
		'lineheightMinusXheightRatio': .54,
		'leftShiftRatio': .06,
		'letterSpacingRatio': -.02
	);
	@include proportionalFont($fontSize, $lineHeight, $fontSpecs);
}

// display

@import url("https://fonts.googleapis.com/css?family=Libre+Franklin:400,700&subset=latin");
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@500&family=DM+Serif+Display&family=DM+Serif+Text:ital@0;1&family=Manuale:ital,wght@0,400;0,600;1,400;1,600&family=DM+Mono&display=swap');

$basefont: "Libre Franklin";
$size: 2rem;
$bgcolor: #f6f6f6;
$textcolor: #333;

html {
	width: 100%;
	height: 100%;
	box-sizing: border-box;
	background: $bgcolor;

	font: 16px/1em $basefont;
}

*,
*:before,
*:after {
	box-sizing: inherit;
	padding-top:0.1px;
}

body {
	margin: 6rem;
	max-width: 40rem;
	color: $textcolor;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	font-weight: 700;
	hyphens: auto;
}

.debug {
	display: flow-root;
	width: 100%;
	outline: 1px inset #f006;
	outline-offset: -1px;
}

h1 {
	@include display(6rem, .85);
	
	padding-bottom: $size;
	padding-top: $size*2;
		
	&:first-of-type {
		//padding-top: $size;
	}
}

h2 {
	@include text(3rem, 1.1);
	
	//font-style: italic;
	
	padding-bottom: $size;
	padding-top: $size;
}

summary {
	@include sans(1.5rem, 1.3);
	
	display: block;
	
	padding-bottom: $size;
}

p {
	@include serif(1rem, 1.6);

	padding-bottom: $size;
	
	&:last-child {
		//padding-bottom: $size;	
	}

}

code {
	@include mono(1rem, 1.5);

	display: block;
	
	padding-bottom: $size;
}

              
            
!

JS

              
                import löremIpsum from "https://codepen.io/smlsvnssn/pen/YzZJWoO.js";
import 'https://codepen.io/smlsvnssn/pen/BrQjRm.js'; // öQuery

const 
	doDebug = true,
	debug = doDebug ? 'debug' : '';  

ö.times(10, _ => {
	
	//ö`<h1>`.html('Tax tar lax').appendTo('body').wrap('<span class="debug">');
	
	ö`<h1>`
		.html(löremIpsum(1, 1, 3, { useLörem: false, isHeadline: true }))
		.appendTo('body')
		.wrap(`<span class="${debug}">`);
	
	ö`<summary>`
		.html(löremIpsum(1, 4, 8, { useLörem: false, isHeadline: false }))
		.appendTo('body')
		.wrap(`<span class="${debug}">`)
	
	ö`<div>`
		.html(löremIpsum(3, 6, 8, { useLörem: false, isHeadline: false }))
		.appendTo('body')
		.find('p')
		.wrap(`<span class="${debug}">`)
	
	ö`<code>`
		.html(löremIpsum(1, 4, 8, { useLörem: false, isHeadline: false }))
		.appendTo('body')
		.wrap(`<span class="${debug}">`)
	
	ö`<h2>`
		.html(löremIpsum(1, 1, 8, { useLörem: false, isHeadline: true }))
		.appendTo('body')
		.wrap(`<span class="${debug}">`)
	
	ö`<div>`
		.html(löremIpsum(3, 4, 8, { useLörem: false, isHeadline: false }))
		.appendTo('body')
		.find('p')
		.wrap(`<span class="${debug}">`)
});
              
            
!
999px

Console