Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ 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

Auto Save

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

              
                <!--Initial design, with full-bleed image-->
<section class="text-media">
	<div class="text-media__col text-media__col--media">
		<div class="text-media__img-wrapper">
			<img class="text-media__img" src='https://images.unsplash.com/photo-1526485856375-9110812fbf35?crop=entropy&cs=srgb&fm=jpg&ixid=MnwxNDU4OXwwfDF8cmFuZG9tfHx8fHx8fHx8MTYyOTc1MDEyMQ&ixlib=rb-1.2.1&q=85' alt='Surfer'>
		</div>
	</div>
	<div class="text-media__col text-media__col--text">
		<div class="text-media__content">
			<h2>Chase your dreams</h2>
			<p>We have 1000s of tutors ready to be matched with you today. There’s never been a better time to start learning that skill you’ve always dreamed of mastering.</p>
			<div class="text-media__links">
				<a class="button" href="#/">Find a tutor →</a>
			</div>
		</div>
	</div>
</section>

<!--Without background color-->
<section class="text-media text-media--no-bg">
	<div class="text-media__col text-media__col--media">
		<div class="text-media__img-wrapper">
			<img class="text-media__img" src='https://images.unsplash.com/photo-1506869640319-fe1a24fd76dc?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwxNDU4OXwwfDF8cmFuZG9tfHx8fHx8fHx8MTYzMDUyNjk1OA&ixlib=rb-1.2.1&q=80&w=400' alt='Silhouette of size people waving on a hill at sunset'>
		</div>
	</div>
	<div class="text-media__col text-media__col--text">
		<div class="text-media__content">
			<h2>Try something new today</h2>
			<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</p>
		</div>
	</div>
</section>

<!--Without background color and with narrower image-->
<section class="text-media text-media--no-bg text-media--narrow">
	<div class="text-media__col text-media__col--media">
		<div class="text-media__img-wrapper">
			<img src='https://images.unsplash.com/photo-1573878585045-4a17c8a39bbd?crop=entropy&cs=srgb&fm=jpg&ixid=MnwxNDU4OXwwfDF8cmFuZG9tfHx8fHx8fHx8MTYzMDUyNzA3OA&ixlib=rb-1.2.1&q=85' alt='Woman with laptop computer smiling at the camera'>
		</div>
	</div>
	<div class="text-media__col text-media__col--text">
		<div class="text-media__content">
			<h2>Discover what you’re capable of</h2>
			<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
			<div class="text-media__links">
				<a class="button" href="#/">Find out more</a>
			</div>
		</div>
	</div>
</section>

<!--With background color and narrow image-->
<section class="text-media text-media--narrow">
	<div class="text-media__col text-media__col--media">
		<div class="text-media__img-wrapper">
			<img class="text-media__img" src='https://images.unsplash.com/photo-1573811363987-13f5bb00dec1?crop=entropy&cs=srgb&fm=jpg&ixid=MnwxNDU4OXwwfDF8cmFuZG9tfHx8fHx8fHx8MTYyOTc1NDA1Mg&ixlib=rb-1.2.1&q=85' alt='Climber on indoor climing wall'>
		</div>
	</div>
	<div class="text-media__col text-media__col--text">
		<div class="text-media__content">
			<h2>Find your passion</h2>
			<p>Dare to do something different. There’s a whole world out there waiting for you to explore. Why not try something new today? You might surprise yourself.</p>
			<div class="text-media__links">
				<a class="button" href="#/">Start exploring →</a>
				<a class="button" href="#/">Sign up for the newsletter</a>
			</div>
		</div>
	</div>
</section>

<!--Without image, no background color-->
<section class="text-media text-media--no-img text-media--no-bg">
	<div class="text-media__col text-media__col--text">
		<div class="text-media__content">
			<h2>Subscribe to our newsletter</h2>
			<p>Be the first to hear when new tutors in your area are added to our platform.</p>
			<div class="text-media__links">
				<a class="button" href="#/">Sign up</a>
			</div>
		</div>
	</div>
</section>

<!--Without image, with background color-->
<section class="text-media text-media--no-img">
	<div class="text-media__col text-media__col--text">
		<div class="text-media__content">
			<h2>Subscribe to our newsletter</h2>
			<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
			<div class="text-media__links">
				<a class="button" href="#/">Sign up</a>
			</div>
		</div>
	</div>
</section>
              
            
!

CSS

              
                /* Vars */
$md: 720px;
$lg: 960px;
$xl: 1200px;

$brand: rgba(21, 74, 235, 1);
$accent: rgba(255, 38, 204, 1);

/* Reset */
* {
	box-sizing: border-box;
}

body {
	font-family: 'Work Sans', sans-serif;
	margin: 0;
	
	@media (min-width: $md) {
		font-size: 1.3rem;
	}
}

img {
	width: 100%;
	display: block;
}

h2 {
	margin: 0;
}

a {
	color: $brand;
}

/* Typography */
h2 {
	font-size: 2rem;
	font-weight: 800;
	
	@media (min-width: $md) {
		font-size: 3rem;
	}
}

p {
	line-height: 1.6;
	
	&:last-of-type {
		margin-bottom: 0;
	}
}

/* Layout */
.text-media {
	--py: 4rem;
	background-color: lighten($brand, 37%);
	
	+ .text-media {
		margin-top: 0.5rem;
	}
	
	@media (min-width: $lg) {
		display: flex;
		
		/* Alternate layouts are reversed */
		&:nth-child(even) {
			flex-direction: row-reverse;
			
			.text-media__content {
				margin-left: auto;
			}
		}
	}
}

.text-media__col {
	position: relative;
	flex: 0 0 50%;
}

.text-media__img-wrapper {
	@media (min-width: $lg) {
		height: 100%;
	}
}

.text-media__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	aspect-ratio: 3 / 2;
}

.text-media__content {
	max-width: 45rem;
	padding: 1rem;
	
	> * + * {
		margin-top: 1rem;
		
		@media (min-width: $md) {
			margin-top: 1.75rem;
		}
	}
	
	@media (min-width: $md) {
		padding: 2rem;
	}
	
	@media (min-width: $lg) {
		padding: var(--pt, var(--py)) 4rem var(--py) 4rem;
	}
}

.text-media__links {
	display: inline-block;
	
	> * + * {
		margin-top: 0.75rem;
	}
	
	.button {
		display: block;
		
		&:nth-child(2n) {
			background-color: $accent;
			
			&:hover,
			&:focus {
				background-color: darken($accent, 15%);
			}
		}
	}
}

.button {
	display: inline-block;
	color: white;
	padding: 0.75rem 2rem;
	text-align: center;
	text-decoration: none;
	background-color: $brand;
	border-radius: 0.3rem;
	font-weight: 800;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	transition: background-color 200ms;
	
	&:hover,
	&:focus {
		background-color: darken($brand, 20%);
	}
}

.button--secondary {
	background-color: $accent;
	color: black;
	
	&:hover,
	&:focus {
		background-color: darken($accent, 20%);
	}
}

/* Variants */
.text-media--narrow {
	@media (min-width: $lg) {
		.text-media__col--media {
			padding: var(--py) 0;
		}

		&:nth-child(even) {
			.text-media__img-wrapper {
				padding: 0 4rem 0 0;
				margin-left: 0;
				margin-right: auto;
			}
		}

		.text-media__img-wrapper {
			position: relative;
			max-width: 45rem;
			padding: 0 0 0 4rem;
			margin-left: auto;
		}

		.text-media__img {
			object-fit: auto;
			height: auto;
		}
	}
}

.text-media--no-bg {
	--pt: 0;
	background-color: transparent;
	
	&.text-media--narrow {
		--py: 0;
	}
}

.text-media--no-img {
	.text-media__content {
		max-width: 65rem;
	}
	
	@media (min-width: $lg) {
		justify-content: center;

		.text-media__col {
			flex: 0 1 75rem;
		}
	}
	
	&.text-media--no-bg {
		--py: 0;
	}
}

.text-media + .text-media--no-bg,
.text-media--no-bg + .text-media {
	@media (min-width: $lg) {
		margin-top: 6rem;
	}
}
              
            
!

JS

              
                
              
            
!
999px

Console