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

              
                <h1>Western Electric Big Button Phone</h1>
<p>The Western Electric Big Button phone was introduced around 1974. It was made available in two color schemes, one orange/yellow and another blue/green. This pen imitates its style using a modern font (Work Sans) and some trickery with text shadows and strokes.</p>
<section>
	<div class="numbers numbers--warm">
		<div class="number">
			<div class="number__inner number__inner--1">
				1
			</div>
		</div>
		<div class="number">
			<div class="number__inner number__inner--2">2</div>
		</div>
		<div class="number">
			<div class="number__inner number__inner--3">3</div>
		</div>
		<div class="number">
			<div class="number__inner number__inner--4">4</div>
		</div>
		<div class="number">
			<div class="number__inner number__inner--5">5</div>
		</div>
		<div class="number">
			<div class="number__inner number__inner--6">6</div>
		</div>
		<div class="number">
			<div class="number__inner number__inner--7">7</div>
		</div>
		<div class="number">
			<div class="number__inner number__inner--8">8</div>
		</div>
		<div class="number">
			<div class="number__inner number__inner--9">9</div>
		</div>
		<div class="number">
			<div class="number__inner">
				<div class="number__inner__asterisk">
				*
				</div>
			</div>
		</div>
		<div class="number">
			<div class="number__inner number__inner--0">0</div>
		</div>
		<div class="number">
			<div class="number__inner number__inner--pound">#</div>
		</div>
	</div>

	<div class="numbers numbers--cool">
		<div class="number">
			<div class="number__inner number__inner--1">
				1
			</div>
		</div>
		<div class="number">
			<div class="number__inner number__inner--2">2</div>
		</div>
		<div class="number">
			<div class="number__inner number__inner--3">3</div>
		</div>
		<div class="number">
			<div class="number__inner number__inner--4">4</div>
		</div>
		<div class="number">
			<div class="number__inner number__inner--5">5</div>
		</div>
		<div class="number">
			<div class="number__inner number__inner--6">6</div>
		</div>
		<div class="number">
			<div class="number__inner number__inner--7">7</div>
		</div>
		<div class="number">
			<div class="number__inner number__inner--8">8</div>
		</div>
		<div class="number">
			<div class="number__inner number__inner--9">9</div>
		</div>
		<div class="number">
			<div class="number__inner">
				<div class="number__inner__asterisk">
				*
				</div>
			</div>
		</div>
		<div class="number">
			<div class="number__inner number__inner--0">0</div>
		</div>
		<div class="number">
			<div class="number__inner number__inner--pound">#</div>
		</div>
	</div>	
</section>

              
            
!

CSS

              
                $height: 6rem;

$gold: #b67300;
$sharon: #bb5504;
$tabasco: #a53a11;
$pueblo: #7a230d;

$eucalyptus: #219162;
$chill: #06858E;
$endeavour: #0664AB;
$catalina: #083286;

$screen-sm: 600px;

@mixin font-properties($color) {
	$text-shadow: null;

	@for $i from 0 through 75 {
		$text-shadow: $text-shadow #{$i}px 0 $color#{if($i !=75, ",", "")};
	}

	text-shadow: $text-shadow;
	text-stroke-color: $color;
	-webkit-text-stroke-color: $color;
	-moz-text-stroke-color: $color;
}

* {
	box-sizing: border-box;
}

body {
	background: rgba($gold, 0.05);
	color: #222;

	display: flex;
	flex-direction: column;
	align-items: center;

	min-height: 100vh;
	
	padding: 0 1rem;

	font-family: "Work Sans", sans-serif;
}

section {
	display: flex;
	flex-direction: column;
	flex-grow: 1;
}

h1 {
	font-size: 3rem;
	margin-bottom: 1rem;
}

p {
	font-size: 1rem;
	line-height: 1.5;
	max-width: 60rem;
	margin-bottom: 1rem;
}

@media only screen and (min-width: $screen-sm) {
	section {
		flex-direction: row;
		justify-content: space-between;
		
		width: 100%;
		max-width: 60rem;
	}
}

button {
	appearance: none;
	border: 0;
	cursor: pointer;
	padding: 0;
}

.numbers {
	display: grid;
	grid-template-rows: repeat(4, $height);
	grid-template-columns: repeat(3, $height);
	grid-gap: 0.1rem;
	margin-bottom: 1rem;

	&--warm {
		.number {
			box-shadow: 0 0 0.2rem rgba($pueblo, 0.2) inset;
			
			&:nth-of-type(1),
			&:nth-of-type(2),
			&:nth-of-type(4) {
				@include font-properties($gold);
			}

			&:nth-of-type(3),
			&:nth-of-type(5),
			&:nth-of-type(7) {
				@include font-properties($sharon);
			}

			&:nth-of-type(6),
			&:nth-of-type(8),
			&:nth-of-type(10) {
				@include font-properties($tabasco);
			}

			&:nth-of-type(9),
			&:nth-of-type(11),
			&:nth-of-type(12) {
				@include font-properties($pueblo);
			}
		}
	}
	
	&--cool {
		.number {
			box-shadow: 0 0 0.2rem rgba($catalina, 0.2) inset;
			
			&:nth-of-type(1),
			&:nth-of-type(2),
			&:nth-of-type(4) {
				@include font-properties($eucalyptus);
			}

			&:nth-of-type(3),
			&:nth-of-type(5),
			&:nth-of-type(7) {
				@include font-properties($chill);
			}

			&:nth-of-type(6),
			&:nth-of-type(8),
			&:nth-of-type(10) {
				@include font-properties($endeavour);
			}

			&:nth-of-type(9),
			&:nth-of-type(11),
			&:nth-of-type(12) {
				@include font-properties($catalina);
			}
		}
	}
}

.number {
	background: white;
	border-radius: 0.5rem;
	color: white;
	font-weight: 800;
	display: flex;

	padding: $height / 12;
	user-select: none;

	paint-order: stroke fill;
	text-stroke-width: 3px;
	-webkit-text-stroke-width: 3px;
	-moz-text-stroke-width: 3px;
}

.number__inner {
	background: transparent;
	border-top-right-radius: $height / 9;
	border-bottom-right-radius: $height / 9;
	box-shadow: 0.5px 0 0.5px rgba(black, 0.5);

	flex-grow: 1;
	width: 100%;
	height: 100%;

	// hacky magic numbers
	font-size: $height * 1.2;
	line-height: 0.66;

	overflow: hidden;

	&--1 {
		font-size: $height * 1.245;
		line-height: 0.6575;
	}
	&--2 {
		font-size: $height * 1.23;
		line-height: 0.66;
	}
	&--3 {
		font-size: $height * 1.195;
		line-height: 0.68;
	}
	&--4,
	&--7 {
		font-size: $height * 1.23;
		line-height: 0.66;
	}
	&--5 {
		font-size: $height * 1.225;
		line-height: 0.655;
	}
	&--6,
	&--8,
	&--9 {
		font-size: $height * 1.2;
		line-height: 0.67;
	}

	&--0 {
		font-size: $height * 1.22;
		line-height: 0.66;
	}
	&--pound {
		font-size: $height * 1.24;
		line-height: 0.6575;
	}
}

.number__inner__asterisk {
	font-size: $height * 1.7;
	position: relative;
	top: 0.7rem;
	left: -0.85rem;
}

              
            
!

JS

              
                // A recreation of the Western Electric Big Button phone produced in the 1970's.  Recreated using flexbox, grid, text shadows, and text strokes. This pen encountered several CSS quirks.

// First, is that setting a border radius and overflow:hidden breaks anti-aliasing on the border radius, leaving a jagged appearance. This was worked around a bit by adding a very soft light box-shadow on the side that has the border radius. This alleviates the problem somewhat.

// Second, text-stroke is still crudely implemented in browsers.  All text strokes are drawn on the outside of the glyph which changes the shape of the glyph. Additionally, text shadows are sized using the inside of the glyph, and end up smaller. To work around this, I oversized the text-stroke and then tried to position each glyph so that the stroke slightly overflowed the container and was cut off. This gives a smoother appearance, but is imprecise and cuts a few of the characters off.
              
            
!
999px

Console