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

              
                <div class="preview-block">
	<div class="image-block">
		<div class="image-block__wrapper">
			<img class="image-block__image" src="https://images.unsplash.com/photo-1549436304-3bfb7b6aab87?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=400&fit=max&ixid=eyJhcHBfaWQiOjE0NTg5fQ" alt="">
		</div>
	</div>
	<div class="preview-block__content">
		<div class="block">
			<button class="btn">
				<span>More</span>
				<span>
					<svg viewBox="0 0 24 24">
						<path d="M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z" />
					</svg>
				</span>
			</button>
			<h2 class="block__title">Lorem Ipsum</h2>
			<h3 class="block__name">John Smith</h3>
			<span class="block__content">Lorem, ipsum dolor sit amet consectetur adipisicing elit. Ipsa praesentium dignissimos ex animi at dolor, a tenetur accusamus nesciunt modi commodi laborum exercitationem asperiores temporibus? Quod quis illum enim corrupti sequi, nulla accusamus quidem tempora nihil dolores consequuntur tenetur reprehenderit explicabo labore sapiente doloribus sint harum adipisci ratione nemo incidunt vero quos! Nemo error esse, dolor molestiae autem quas magni dicta incidunt similique rerum tempore repellendus libero quis unde, laudantium, ipsam suscipit. Quaerat, suscipit laudantium. Quae, est excepturi nobis quaerat possimus neque quas ex architecto. Dolores, odio voluptatibus dolore quas odit nobis explicabo eos, veniam molestiae numquam laudantium nesciunt repellendus!
			</span>
		</div>
		<div class="block__tags">
			<div class="block__tags-item">films</div>
			<div class="block__tags-item">music</div>
			<div class="block__tags-item">adventures</div>
			<div class="block__tags-item">travel</div>
			<div class="block__tags-item">persons</div>
			<div class="block__tags-item">read</div>
			<div class="block__tags-item">moods</div>
		</div>
		<div class="page-actions">
			<button class="page-actions__button page-actions__button--prev">
				<svg width="24" height="24" viewBox="0 0 24 24">
					<path d="M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z"></path>
				</svg>
			</button>
			<button class="page-actions__button page-actions__button--chat">
				<svg width="24" height="24" viewBox="0 0 24 24">
				  <path d="M9,22A1,1 0 0,1 8,21V18H4A2,2 0 0,1 2,16V4C2,2.89 2.9,2 4,2H20A2,2 0 0,1 22,4V16A2,2 0 0,1 20,18H13.9L10.2,21.71C10,21.9 9.75,22 9.5,22V22H9Z"></path>
				</svg>
			</button>
			<button class="page-actions__button page-actions__button--like">
				<svg width="24" height="24" viewBox="0 0 24 24">
				  <path d="M12,21.35L10.55,20.03C5.4,15.36 2,12.27 2,8.5C2,5.41 4.42,3 7.5,3C9.24,3 10.91,3.81 12,5.08C13.09,3.81 14.76,3 16.5,3C19.58,3 22,5.41 22,8.5C22,12.27 18.6,15.36 13.45,20.03L12,21.35Z"></path>
				</svg>
			</button>
			<button class="page-actions__button page-actions__button--next">
				<svg width="24" height="24" viewBox="0 0 24 24">
					<path d="M4,11V13H16L10.5,18.5L11.92,19.92L19.84,12L11.92,4.08L10.5,5.5L16,11H4Z"></path>
				</svg>
			</button>
		</div>
	</div>
</div>
              
            
!

CSS

              
                $mxw: 450px
@import url('https://fonts.googleapis.com/css?family=Poppins')
$font: 'Poppins', sans-serif
$green: #1B998B

html,
body
	width: 100%
	height: 100%
	padding: 0
	margin: 0
	box-sizing: border-box
	font-family: $font
*,
*::before,
*::after
	box-sizing: inherit
.preview-block
	position: absolute
	left: 50%
	top: 10%
	transform: translate(-50%)
	max-width: $mxw
	width: 100%
	&__content
		position: relative
		z-index: 100
		top: -40px
.image-block
	height: $mxw / 1.5
	width: 100%
	position: relative
	z-index: -1
	box-shadow: 1px 3px 20px #aaa
	&__wrapper
		height: 100%
		width: 100%
		position: relative
		overflow: hidden
		border-radius: 5px
	&__image
		position: absolute
		width: 100%
		height: auto
		top: 50%
		left: 50%
		transform: translate(-50%, -50%)
		transition: 0.3s ease
.btn
	position: absolute
	display: flex
	align-items: center
	z-index: 1000
	bottom: 5px
	left: 10px
	background-color: transparent
	border: none
	color: #1B998B
	cursor: pointer
	transition: 0.3s ease
	outline: none
	span
		height: 15px
	svg
		width: 15px
		height: 15px
		fill: #1B998B
	&:hover
		color: #1B998B
		letter-spacing: 1.3px
.block
	max-width: $mxw
	width: 100%
	max-height: 200px
	box-shadow: 1px 3px 20px #aaa
	border-radius: 5px
	overflow: hidden
	background-color: #fff
	padding: 15px
	transition: 0.6s ease
	position: relative
	font-size: 0.9em
	&__content
		display: inline-block
		transition: 0.3s ease
	&:before
		content: ''
		position: absolute
		width: 100%
		height: 50%
		bottom: 0
		left: 0
		transition: 0.3s ease
		background-image: linear-gradient(0deg, #fff 30%, transparent)
	&__title
		margin-bottom: 0
		color: #aaa
	&__name
		margin: 0 0 1em
		font-size: 0.8em
		color: $green
	&--open
		transition: 0.6s ease
		max-height: 1000px
		padding: 15px
		&:before
			opacity: 0
			z-index: -200
		.btn
			bottom: 10px
			span
				display: inline
			svg
				transform: rotate(180deg)
		.block__content
			display: block
			padding-bottom: 20px
	&__tags
		max-width: $mxw
		width: 100%
		box-shadow: 1px 3px 20px #aaa
		border-radius: 5px
		padding: 15px 15px 0.5em
		margin: 15px 0
		font-size: 0.9em
	&__tags-item
		padding: 0.2em 0.8em
		font-size: 0.8em
		margin-bottom: 0.5em
		margin-right: 0.5em
		color: #fff
		border-radius: 2em
		display: inline-block
		line-height: 1.6em
		background-color: $green
.page-actions
	display: flex
	flex-direction: row
	justify-content: space-between
	align-items: center
	max-width: $mxw
	width: 100%
	padding: 1em
	box-shadow: 1px 3px 20px #aaa
	border-radius: 5px
	overflow: hidden
	&__button
		border-radius: 50%
		border: none
		width: 60px
		height: 60px
		background-color: #fff
		box-shadow: 1px 5px 20px #aaa
		position: relative
		top: 130px
		cursor: pointer
		animation: jump_go 0.5s ease forwards
		transition: 0.3s ease
		svg
			fill: #fff
			width: 30px
			height: 30px
			position: relative
			top: 2px
	&__button--prev
		width: 52px
		height: 52px
		animation-delay: 0s
		&:hover
			box-shadow: 1px 5px 30px #aaa
		&:active
			box-shadow: 1px 5px 10px #aaa
		svg
			fill: #888
	&__button--chat
		background-color: #1B998B
		box-shadow: 1px 5px 20px rgba(#1B998B, 0.6)
		animation-delay: 0.1s
		transition: 0.3s ease
		&:hover
			box-shadow: 1px 5px 30px rgba(#1B998B, 0.6)
		&:active
			box-shadow: 1px 5px 10px rgba(#1B998B, 0.6)
	&__button--like
		background-color: #E71D36
		box-shadow: 1px 5px 20px rgba(#E71D36, 0.6)
		animation-delay: 0.2s
		transition: 0.3s ease
		&:hover
			box-shadow: 1px 5px 30px rgba(#E71D36, 0.6)
		&:active
			box-shadow: 1px 5px 10px rgba(#E71D36, 0.6)		
	&__button--like-remove
		animation: remove_animation_go 0.3s ease forwards
	&__button--next
		width: 52px
		height: 52px
		animation-delay: 0.3s
		&:hover
			box-shadow: 1px 5px 30px #aaa
		&:active
			box-shadow: 1px 5px 10px #aaa
		svg
			fill: #888
@keyframes jump_go
	0%
		transform: translateY(0) scale(0.3)
	30%
		transform: translateY(-140px) scale(0.7)
	40%
		transform: translateY(-120px) scale(0.95)
	50%
		transform: translateY(-135px) scale(1)
	60%
		transform: translateY(-125px) scale(0.95)
	100%
		transform: translateY(-130px) scale(1)
@keyframes remove_animation_go
	0%
		transform: translateY(-130px) scale(1)
	90%
		transform: translateY(-130px) scale(1.1)
	100%
		transform: translateY(-130px) scale(0)
@media screen and (max-width: #{$mxw})
	.preview-block
		top: 0
	.image-block__wrapper
		border-radius: 0


	
              
            
!

JS

              
                var cards = [
	{
		title: 'Lorem Ipsum',
		author: 'John Smith',
		content: "It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).",
		tags: ['films', 'music', 'adventures', 'travel', 'persons', 'read', 'moods'],
		image: "https://images.unsplash.com/photo-1549436304-3bfb7b6aab87?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=400&fit=max&ixid=eyJhcHBfaWQiOjE0NTg5fQ"
	},{
		title: 'Why do we use it?',
		author: 'Mary McTee',
		content: "There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet.",
		tags: ['films', 'music', 'adventures'],
		image: "https://images.unsplash.com/photo-1547984543-e086e6d786b5?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=400&fit=max&ixid=eyJhcHBfaWQiOjE0NTg5fQ"
	},{
		title: 'Where does it come from',
		author: 'Marco Polo',
		content: `Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.
The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum' by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.`,
		tags: ['films', 'music', 'adventures', 'travel', 'persons', 'read', 'moods', 'literature', 'renaissance'],
		image: "https://images.unsplash.com/photo-1547473078-cbab237054c0?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=400&fit=max&ixid=eyJhcHBfaWQiOjE0NTg5fQ"
	}
];
var previewPage = (function($, data){
	var profile = {
		currentContentOnButton: '',
		contentOnButtonIfBlockOpen: '<span>Hide</span><span><svg viewBox="0 0 24 24"><path d="M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z" /></svg></span>',
		currentActivePageIndex: 0,
		pageAmount: data.length,
		lastPageIndex: data.length - 1,
		setControllers: function () {
			var self = this;
			$('.btn').on('click', function () {
				var block = $('.block');	
				if( !block.hasClass('block--open') ){
					self.currentContentOnButton = $(this).html();
					$(this).html(self.contentOnButtonIfBlockOpen);
				}else{
					$(this).html(self.currentContentOnButton);
				}
				$('.block').toggleClass('block--open');
			});
			$('.page-actions__button--like').on('click', function () {
				$(this).addClass('page-actions__button--like-remove');
				var _self = $(this);
				setTimeout(function () {
					_self.remove();
				}, 300);
		 	});
			$(document).on('click', '.page-actions__button--prev', function () {
				self.getActiveIndex('prev');
				self.setDataOnPreviewPage(self.currentActivePageIndex)
			});
			$(document).on('click', '.page-actions__button--next', function () {
				self.getActiveIndex('next');
				self.setDataOnPreviewPage(self.currentActivePageIndex)
			});
		},
		getActiveIndex: function (direction) {
			if (direction === 'prev') {
				if (this.currentActivePageIndex === 0) {
					this.currentActivePageIndex = this.lastPageIndex;
				}else{
					this.currentActivePageIndex--;
				}
			}
			if (direction === 'next') {
				 if (this.currentActivePageIndex === this.lastPageIndex){
					this.currentActivePageIndex = 0;
				}else{
					this.currentActivePageIndex++;
				}
			}
		},
		setDataOnPreviewPage: function (index) {
			var currentData = data[index];
			var image = $('.image-block__image').attr('src', currentData.image);
			$('.image-block__image').css({filter: 'blur(15px)'});
			setTimeout(function(){
				$('.image-block__image').css({filter: 'blur(0px)'});
			},300);
			var content = $('.block__content').html(currentData.content);
			var title = $('.block__title').html(currentData.title);
			var name = $('.block__name').html(currentData.author);
			var tagsContainer = $('.block__tags');
			tagsContainer.empty();
			currentData.tags.forEach(function (tag) {
				tagsContainer.append('<div class="block__tags-item">'+ tag +'</div>');
			});
			
		},
		init: function () {
			this.setDataOnPreviewPage(this.currentActivePageIndex)
			this.setControllers();
		}
	};
	return profile;
}($, cards));

 previewPage.init();
/*
var currentContent;
$('.btn').on('click', function () {
	var block = $('.block');	
	var newContent = 'hide';
	if( !block.hasClass('block--open') ){
		currentContent = $(this).text();
		$(this).text(newContent);
	}
	if( block.hasClass('block--open') ){
		$(this).text(currentContent);
	}
	$('.block').toggleClass('block--open');
});
$('.page-actions__button--like').on('click', function () {
	$(this).addClass('page-actions__button--like-remove');
	var self = $(this);
	setTimeout(function () {
		self.remove();
	}, 300);
});
*/

/*
function showAndHideInfo () {
	var isOpen = false;
	var max = $('span').height();
	var min = $('.block').height();
	$('.btn').on('click', function () {
		if ( !isOpen ) {
			$('.block').animate({height: max+"px"}, 300);
		}else{
			$('.block').animate({height: min+"px"}, 300);
		}
		isOpen = !isOpen;
	});
}
showAndHideInfo();
*/
              
            
!
999px

Console