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

              
                <header>
	Form Input Label Style<br />
	<a href="https://muki.tw/tech/html-css/css-form-input-label-style" target="_blank">(https://muki.tw/tech/html-css/css-form-input-label-style)</a>
</header>

<section>
	<div class="mb-4">預設 input 樣式:</div>
	<div class="flex w-[30rem] flex-col">
		<div class="relative mb-5">
				<input type="text" class="w-full form--item" placeholder=" " />
				<label class="label">登入帳號</label>
		</div>
		<div class="relative mb-5">
				<input type="password" class="w-full form--item" placeholder=" " />
				<label class="label">登入密碼</label>
		</div>
	</div>
	
	<div class="mb-4">自動帶入帳密時:</div>
	<div class="flex w-[30rem] flex-col">
		<div class="relative mb-5">
				<input type="text" class="w-full form--item" placeholder=" " value="mmm@gmail.com" />
				<label class="label">登入帳號</label>
		</div>
		<div class="relative mb-5">
				<input type="password" class="w-full form--item" placeholder=" " value="12345" />
				<label class="label">登入密碼</label>
		</div>
	</div>
		
	<div class="mb-4">textarea:</div>
	<div class="flex w-[30rem] flex-col">
		<div class="relative mb-5">
    <textarea class="w-full form--item" placeholder=" " rows="5"></textarea>
    <label class="label">備註</label>
  </div>
	</div>
</section>
              
            
!

CSS

              
                @import "compass/css3";

/**
Form Input Label Style
Autohr: Muki Wu
Article: https://muki.tw/tech/html-css/css-form-input-label-style
**/

/* demo code start */

.label {
	position: absolute;
	left: 1rem;
	top: 20px;
	transition: all .2s ease;
}

.form--item {
	background: rgb(38, 38, 38);
	padding: 1.75rem 1rem .75rem;
	&:focus {
		background: rgb(64, 64, 64);
		border-bottom: 2px solid #D9444A;
		outline-width: 0;
	}
}

input:focus + label, input:not(:placeholder-shown) + label,
textarea:focus + label, textarea:not(:placeholder-shown) + label {
	top: 5px;
	font-size: 13px;
	color: #D9444A;
}

input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus {
  -webkit-text-fill-color: rgb(163, 163, 163);
  -webkit-box-shadow: 0 0 0px 500px #262626 inset;
  transition: background-color 5000s ease-in-out 0s;
}

/* basic layout start (you can skip it) */

body {
	font-family: arial, sans-serif;
	background: #333;
	font-size: 16px;
	color: #f0f0f0;
	line-height: 1.1em;
}

a {
	text-decoration: none;
	color: #313131;
	&:hover {
		color: #000;
	}
}
section {
	max-width: 500px;
	margin: 0 auto;
	background: #555;
	padding: 1em;
}
header {
	background: #d9444a;
	text-align: center;
	color: #fff;
	padding: 0.7em 0;
	a {
		color: rgba(255, 255, 255, 0.6);
		@include text-shadow(1px 1px 1px #973735);
	}
	&:after {
		content: " ";
		position: absolute;
		width: 0;
		height: 0;
		border-width: 10px;
		border-style: solid;
		border-color: #d9444a transparent transparent transparent;
		top: 53px;
		left: 50%;
	}
}

h2 {
	font-size: 1em;
	margin: 0 0 0.5em 0;
	background: #444;
	display: inline-block;
	padding: 0.5em 1.2em;
	position: relative;
	left: -1em;
}

              
            
!

JS

              
                
              
            
!
999px

Console