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

              
                .container
	h1 Material Design Form Label Effect
	
	p Go To Blog:
		a(href="https://letswrite.tw/material-design-label-effect/", target="_blank") Google Material Design 表單標籤效果
	
	.input-block
		input#name(type="text", required)
		label(for="name") Name
	
	.input-block
		input#nickname(type="text")
		label(for="nickname") Nickname
              
            
!

CSS

              
                *, *::before, *::after
	box-sizing: border-box

.container
	margin: 50px auto
	padding-right: 12px
	padding-left: 12px
	max-width: 420px

h1
	margin-bottom: 24px
	text-align: center
	font-size: 20px

a
	text-decoration: none
	color: #00baff
	transition: .3s
	&:hover
		color: #008BBF

.input-block
	position: relative
	margin-bottom: 16px
	input:not([type="radio"]):not([type="checkbox"]):not([type="file"])
		appearance: none
		padding: 14px 10px 0
		width: 100%
		height: 48px
		line-height: 20px
		border: 1px solid #CCC
		border-radius: 4px
		outline: none
		+ label
			position: absolute
			top: 14px
			left: 10px
			letter-spacing: 1px
			font-size: 18px
			color: #9E9E9E
			cursor: text
			transition: .2s ease-in-out
		&[required] + label::after
			content: '*'
			color: #F44336
		&:focus, &.fill
			+ label
				top: 6px
				font-size: 12px
		&:focus
			border-color: #00baff
              
            
!

JS

              
                $(function() {
	$('.input-block input').each(function() {
		const _this = $(this);
		_this.on('input', e => {
			_this.val() !== '' ? _this.addClass('fill') : _this.removeClass('fill');
		})
	})
});
              
            
!
999px

Console