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 id="app" class="flex w-screen h-auto p-4">
	<div class="w-1/4 h-full bg-grey-darkest"></div>
	<div class="flex-col w-1/2 h-full bg-grey-lightest rounded-lg overflow-scroll p-2 shadow-md">
		<h1 class="flex-1 font-sans font-thin text-center text-5xl text-grey-darkest">Todos</h1>
		  <div class="flex items-center border-b border-b-2 border-teal py-2">
			<input class="font-sans font-thin text-2xl appearance-none bg-transparent border-none w-full text-grey-darker mr-3 py-1 px-2 leading-tight focus:outline-none" 
				   type="text" 
				   placeholder="New Todo" 
				   aria-label="Full name"
				   v-model="newTodo"
				   @keypress.enter="addTodo(newTodo)"
				   >
			<button class="flex-no-shrink bg-purple hover:bg-purple-dark border-purple hover:border-purple-dark text-sm border-4 text-white py-1 px-2 rounded" 
					type="button"
					@click="addTodo(newTodo)"
					>
			  Add
			</button>
			<button class="flex-no-shrink border-transparent border-4 text-red hover:text-teal-darker text-sm py-1 px-2 rounded" 
					type="button"
					@click="cancelTodo()"
					>
			  Cancel
			</button>
		  </div>
		<template v-if="todos.length == 0">
			<h3 class="flex-1 font-sans font-thin text-center text-3xl text-grey-darker bg-teal-lighter p-4 m-1">No Todos</h3>
		</template>
		<template v-else>
			<div class="flex bg-grey-light w-full h-auto p-2 mt-4 rounded-lg" v-for="(todo, index) in todos" :key="index">
				<h3 class="w-5/6 font-sans font-light text-2xl text-center bg-grey-lightest pt-1 shadow-md rounded-lg">{{ todo }}</h3>
				<div class="w-1/6 text-right pr-2 xHolder">
					<i class="fa fa-times text-2xl" aria-hidden="true" @click="removeTodo(index)"></i>
				</div>
			</div>
			<button class="w-full bg-red-light hover:bg-red text-white font-thin py-2 px-8 mt-4 rounded"
					@click="clearAll()"
					>
				Clear All
			</button>
		</template>
	</div>
	<div class="w-1/4 h-full bg-grey-darkest"></div>
</div>
              
            
!

CSS

              
                html {
	background-color: #e6e6e6;
	font-size: 12pt;
}

.xHolder {
	padding-top: .4rem;
	color: #EF5753;
	font-size: 2rem;
	transition-duration: .5s;
}

.xHolder i:hover {
	transition-duration: .5s;
	color: red;
	transform: rotate(90deg);
	font-size: 2.5rem;
	cursor: pointer;
}
              
            
!

JS

              
                let app = new Vue({
	el: '#app',
	data: {
		newTodo: '',
		todos: []
	},
	methods: {
		addTodo (todo) {
			this.todos.push(todo)
			this.newTodo = ''
		},
		cancelTodo () {
			this.newTodo = ''
		},
		removeTodo (index) {
			this.todos.splice(index, 1)
		},
		clearAll () {
			this.todos = []
		}
	}
})
              
            
!
999px

Console