css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <html>
<body>
	<div id="app">
		
		<modal>
			<template slot="callToActionText">
				Test the VueJS modal here
			</template>
			<template slot="modalHeader">
				Sign in to your account
			</template>
			<template slot="modalBody">
				<label>E-mail</label>
				<input type="email" placeholder="mail@example.com">
				<label>Password</label>
				<input type="password" placeholder="+8 chars" auto-complete="new-password">
				
			</template>
			<template slot="modalFooter">
				<button class="button">Sign in</button>
			</template>
		</modal>
		
		<script type="text/x-template" id="modal">
			<div class="modal">
				
				<!-- The call to action text -->
				<div class="modal__cta">
					<slot name="callToActionText"></slot>
				</div>
				
				<!-- The modal button -->
				<div class="modal__button">
					<button class="button" @click="click">Open modal</button>
				</div>
				
				<!-- The modal dialog -->
				<div class="modal__dialog" :class="{'active' : active}">
					<div class="modal__content">
						<button class="modal__close" @click="click">
							<i class="fa fa-times"></i>
						</button>
						<h3 class="modal__header">
							<slot name="modalHeader"></slot>
						</h3>
						<div class="modal__body">
							<slot name="modalBody"></slot>
						</div>
						<div class="modal__footer">
							<slot name="modalFooter"></slot>
						</div>
					</div>
				</div>
					
				<!-- The overlay for the modal -->
				<div class="modal__overlay"></div>
			</div>
		</script>
	</div>
	

</body>
</html>
            
          
!
            
              body, button, input, select
	font-family: 'Catamaran', sans-serif

#app
	display: flex
	justify-content: center
	align-items: center
	height: 100vh

label
	color: rgba(0, 0, 0, .45)
	font-size: 12px
	display: block
input
	border: 1px solid rgba(0, 0, 0, .10)
	background: #ffffff
	box-shadow: none
	color: #000
	padding: 16px
	outline: 0
	margin-bottom: 12px
	border-radius: 2px
	font-weight: 300
	font-size: 11px
	letter-spacing: 1px
	&::placeholder
		color: #c9c9c9
		font-size: 11px
	&:focus
		color: #555555
		background: #ffffff
		border-color: #673ab7

.button 
	cursor: pointer
	background: #673ab7
	border: 0
	border-radius: 50px
	color: #ffffff
	padding: 12px 60px
	font-weight: 700
	font-size: 15px
	outline: 0
	text-transform: uppercase
	margin: 0 auto
	display: table
	&:hover
		background: darken(#673ab7, 5%)

.modal
	display: flex
	justify-content: center
	align-items: center
	min-height: 250px
	flex-direction: column

	&__cta
		margin: 24px 0
		font-size: 24px
		color: rgba(0, 0, 0, .45)

	&__overlay
		position: fixed
		width: 100%
		height: 100%
		visibility: hidden
		top: 0
		left: 0
		z-index: 1000
		opacity: 0
		background: #000000
		transition: all .25s

	&__dialog
		position: fixed
		top: 50%
		left: 50%
		width: 50%
		max-width: 630px
		min-width: 320px
		height: auto
		z-index: 2000
		visibility: hidden
		backface-visibility: hidden
		transform: translateX(-50%) translateY(-50%)
		perspective: 1300px
		&.active 
			opacity: 1
			visibility: visible
			~ .modal__overlay
				opacity: .9
				visibility: visible
			.modal__content
				transform: rotateX(0deg)
				opacity: 1

	&__content
		background: #fafafa
		border-radius: 2px
		padding: 24px
		color: #131313
		position: relative
		transform-style: preserve-3d
		transform: rotateX(-60deg)
		transform-origin: 50% 0
		opacity: 0
		transition: all .25s
		
	&__close
		position: absolute
		right: -16px
		top: -16px
		color: #fff
		background: #673ab7
		border: 0
		outline: 0
		border-radius: 50%
		font-size: 16px
		width: 32px
		height: 32px
		cursor: pointer
	&__header
		text-align: center
		font-weight: 300
		font-size: 24px
		color: rgba(0, 0, 0, .45)
	&__body
		color: #ffffff
		display: flex
		margin: 0 auto
		width: 100%
		max-width: 400px
		flex-direction: column
	&__footer
		margin: 24px 0
            
          
!
            
              Vue.component('modal', {
	template: '#modal',
	data() {
		return {
			active: false
		}
	},
	methods: {
		click(e) {
			this.active =! this.active;
		}
	}
});

new Vue({
	el: '#app'
});
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console