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

              
                <section id="js-grid-list" class="grid-list" v-cloak>

	<div class="tool-bar">
		<!-- These link buttons use Vue.js to bind click events to change the "layout" variable and bind an active class -->
		<a class="list-icon" v-on:click="layout = 'list'" v-bind:class="{ 'active': layout == 'list'}" title="List"></a>
		<a class="grid-icon" v-on:click="layout = 'grid'" v-bind:class="{ 'active': layout == 'grid'}" title="Grid"></a>
	</div>

	<!-- Vue.js lets us choose which UL to show depending on the "layout" variable -->
	
	<ul v-if="layout === 'grid'" class="grid">
		<!-- A "grid" view with photos only -->
		<li v-for="blog in blog_posts">
			<a v-bind:href="blog.url" v-bind:style="{ backgroundImage: 'url(' + blog.image.large + ')' }" target="_blank"></a>
		</li>
	</ul>

	<ul v-if="layout === 'list'" class="list">
		<!-- A "list" view with small photos and blog titles -->
		<li v-for="blog in blog_posts">
			<a v-bind:href="blog.url" target="_blank">
				<img v-bind:src="blog.image.small">
				<p>{{blog.title}}</p>
			</a>
		</li>
	</ul>

</section>
              
            
!

CSS

              
                [v-cloak] {
		/* Hide un-compiled mustache bindings until the Vue instance is ready */
		display: none;
}

* {
		box-sizing: border-box;
}

a,
a:visited,
a:hover {
	color: #389dc1;
	display: block;
	outline: none;
	text-decoration: none;
}

a:hover {
	text-decoration: none;
}

.grid-list {
	background-color: #fff;
	color: #5e5b64;
	font: 17px/1.3 "Open Sans", sans-serif;
	margin: 0 auto;
	max-width: 1024px;
	min-width: 300px;
	padding: 30px;
	text-align:center;
}

/* The tool bar */
.tool-bar {
	background-color: #ED1C24;
	background-image: url( "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAYEBAQFBAYFBQYJBgUGCQsIBgYICwwKCgsKCgwQDAwMDAwMEAwODxAPDgwTExQUExMcGxsbHB8fHx8fHx8fHx//2wBDAQcHBw0MDRgQEBgaFREVGh8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx//wAARCABeAF4DAREAAhEBAxEB/8QAHAABAAICAwEAAAAAAAAAAAAAAAYHBQgBAgQD/8QANRAAAQQBAgUBBQQLAAAAAAAAAQACAwQFBhEHEyExQUISIjJRYQgjUoEzQ0ZTYnFykpShwv/EABsBAQABBQEAAAAAAAAAAAAAAAAFAgMEBgcB/8QANBEBAAIBAgUBAwkJAAAAAAAAAAECAwQRBQYSITFBEyJhFBVCUXGRwdHhFjIzUlNigZKx/9oADAMBAAIRAxEAPwCHLW3dxAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBBsRwi4eYVmk4ruYxtW7ZvnnMNmCOVzGdg0e207dt1L6XBXo3mN93NeYuMZZ1M0xXtWtO3uzMbz/AITY6F0Sf2fxv+JAP+Fkexp/LH3IH511f9XJ/vb81ZcZLOisBjxicbhMezL2gC6RlaJroY/xAhoO7vCw9XNKxtERu2rlumq1F/aZMmT2df7p7yo5RjfhAQEBAQEBBINCack1DqeljgDyXPDrDx6Y29SVew4+u0QjeK62NNp7X9du32tt4IY4YWQxgNZG0NaB0AAGynYjZxy1ptMzPqwmtdWUdMYObI2XDmbFtaLy+Q9gB9PKt5ssUrvLO4Zw++qzRSvj1+ENUMzl72YydjI3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SGWeVxfJI47kk/zViZ3neUvjx1pWK1jaIfJeKxAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEH/9k=" );
	background-position: top left;
	background-repeat: no-repeat;
	background-size: contain;
	box-shadow: 0 1px 1px #ccc;
	line-height: 1;
	margin: 0 auto;
	padding: 10px;
	position: relative;
	text-align: right;
	width: 100%;
}

.tool-bar a {
	background: rgba( 255, 255, 255, 0.50 ) center center no-repeat;
	border: 1px solid #e4e4e4;
	border-right: 1px solid #908f8f;
	border-bottom: 1px solid #908f8f;
	cursor: pointer;
	display: inline-block;
	height: 32px;
	margin-right: 5px;
	text-decoration: none;
	width: 32px;
}

.tool-bar a:hover {
	border: 1px solid #e4e4e4;
}

.tool-bar a.active {
	background-color: rgba( 0, 0, 0, 0.50 );
	border: 1px solid #908d8d;
	border-right: 1px solid #e2e2e2;
	border-bottom: 1px solid #e2e2e2;
}

.tool-bar a.active:hover {
	cursor: default;
}

.tool-bar a.list-icon {
	background-image: url( "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyBpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3h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ABH6AB8x/JaQzEig++WPiII7Rxio/GwmCIBYAAAwAwVIzMp1R0aQAAAABJRU5ErkJggg==" );
}

/* Grid layout */
.grid {
	background-color: #ddedfb;
	list-style: none;
	margin: 0 auto;
	padding: 20px;
	text-align: left;
	width: 100%;
}

.grid li {
	display: inline-block;
	position: relative;
	width: 50%;
}

.grid li:after {
	content: "";
	display: block;
	padding-bottom: 52%;
}

.grid li a {
	background-position: center;
	background-repeat: no-repeat;
	background-size: cover;
	border: 2px solid #fff;
	height: 99%;
	position: absolute;
	width: 98%;
}

.grid li a:hover {
	border: 2px solid #000;
	box-shadow:         inset 0 0 90px -10px rgba( 0, 0, 0, 1 );
	-moz-box-shadow:    inset 0 0 90px -10px rgba( 0, 0, 0, 1 );
	-webkit-box-shadow: inset 0 0 90px -10px rgba( 0, 0, 0, 1 );
}

/* List layout */
.list {
	background-color: #ddedfb;
	list-style: none;
	margin: 0 auto;
	padding: 0;
	text-align: left;
	width: 100%;
}

.list li {
	border-bottom: 1px solid #fff;
	overflow: hidden;
	padding: 20px;
	transition: background 0.2s linear;
}

.list li:hover {
	background-color: #fff;
}

.list li a {
	display: table;
	width: 100%;
}


.list li img {
	border: none;
	display: table-cell;
	height: 120px;
	vertical-align: middle;
	width: 120px;
}

.list li:hover p {
	color: #0096d4;
}

.list li p {
	color: #000;
	display: table-cell;
	font-weight: 700;
	padding: 0 0 0 15px;
	vertical-align: middle;
	width: 100%;
}
              
            
!

JS

              
                var blog_list = new Vue({
	el: '#js-grid-list',
	data: {
		// The layout mode, possible values are "grid" or "list".
		layout: 'grid',

		// demo data
		blog_posts: [{
			title: 'Tapping into UGC with Offerpop',
			url: 'https://voltagead.com/tapping-ugc-offerpop/',
			image: {
				'large': 'https://2e64oz2sjk733hqp882l9xbo-wpengine.netdna-ssl.com/wp-content/uploads/2016/08/header-960x500-copy-960x500.jpg',
				'small': 'https://2e64oz2sjk733hqp882l9xbo-wpengine.netdna-ssl.com/wp-content/uploads/2016/08/header-960x500-copy-300x300.jpg'
			}
		}, {
			title: '5 websites that get design right',
			url: 'https://voltagead.com/5-websites-get-design-right/',
			image: {
				'large': 'https://2e64oz2sjk733hqp882l9xbo-wpengine.netdna-ssl.com/wp-content/uploads/2016/08/HERO-960x500.jpg',
				'small': 'https://2e64oz2sjk733hqp882l9xbo-wpengine.netdna-ssl.com/wp-content/uploads/2016/08/HERO-300x300.jpg'
			}
		}, {
			title: 'Mariachis, Hats, and Pies, Oh My!',
			url: 'https://voltagead.com/mariachis-hats-pies-oh/',
			image: {
				'large': 'https://2e64oz2sjk733hqp882l9xbo-wpengine.netdna-ssl.com/wp-content/uploads/2016/07/IMG_2629.2-960x582.jpg',
				'small': 'https://2e64oz2sjk733hqp882l9xbo-wpengine.netdna-ssl.com/wp-content/uploads/2016/07/IMG_2629.2-300x300.jpg'
			}
		}, {
			title: 'Big buzz. Big brands. Reebok does omnichannel.',
			url: 'https://voltagead.com/big-buzz-big-brands-reebok-omnichannel/',
			image: {
				'large': 'https://2e64oz2sjk733hqp882l9xbo-wpengine.netdna-ssl.com/wp-content/uploads/2016/07/reebok-hero2.jpg',
				'small': 'https://2e64oz2sjk733hqp882l9xbo-wpengine.netdna-ssl.com/wp-content/uploads/2016/07/reebok-hero2-300x300.jpg'
			}
		}, {
			title: 'Colorado Ad Day',
			url: 'https://voltagead.com/denver-ad-day/',
			image: {
				'large': 'https://2e64oz2sjk733hqp882l9xbo-wpengine.netdna-ssl.com/wp-content/uploads/2016/07/sample-blog-960x577.jpg',
				'small': 'https://2e64oz2sjk733hqp882l9xbo-wpengine.netdna-ssl.com/wp-content/uploads/2016/07/sample-blog-300x300.jpg'
			}
		}, {
			title: 'Using the Ordinary to Build the Extraordinary',
			url: 'https://voltagead.com/using-ordinary-build-extraordinary/',
			image: {
				'large': 'https://2e64oz2sjk733hqp882l9xbo-wpengine.netdna-ssl.com/wp-content/uploads/2016/06/header-960x500.jpg',
				'small': 'https://2e64oz2sjk733hqp882l9xbo-wpengine.netdna-ssl.com/wp-content/uploads/2016/06/header-300x300.jpg'
			}
		}]
	}
});
              
            
!
999px

Console