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 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

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

              
                <div class="fb-Search">
	<input id="Input" class="fb-Search_Input" value="">
	<span class="fb-Search_FauxInput" dir="rtl"></span>
	<label class="fb-Search_Label" for="Input">Search</label>
</div>
              
            
!

CSS

              
                @use cssnext;
@use postcss-nested;
@use postcss-simple-vars;
* {
	box-sizing: border-box;
}

body {
	background-color: #555;
	font-family: sans-serif;
}

.fb-Search {
	display: flex;
	height: 44px;
	padding: 5px 70px 5px 5px;
	width: 400px;
	position: relative;
	background-color: #e4e4e4;
}

.fb-Search_Input {
	appearance: none;
	.js & {
		position: absolute;
		left: -100vw;
	}
}

.fb-Search_FauxInput {
	display: none;
    align-items: center;
    max-width: 80%;
    border: 0;
    font-size: 1.3rem;
		color: #777;
    background-color: #e4e4e4;
    border-right: 3px solid transparent;
	.js & {
		display: flex;
	}
    .fb-Search_Input:focus ~ & {
        animation: pulseAttention 1.5s cubic-bezier(.215, .61, .355, 1) forwards infinite;
    }
}

.fb-Search_Label {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    padding: 5px;
    display: flex;
    align-items: center;
    color: #a7a7a7;
    font-size: 15px;
    
    .fb-Search_Input:not([value=""]) ~ & {
        justify-content: flex-end;
    }
}

@keyframes pulseAttention {
    50% {
        border-color: green;
    }
}
              
            
!

JS

              
                // Communicate to DOM that we have JS

document.documentElement.setAttribute("class", "js");

var searchFauxInput = document.querySelector(".fb-Search_FauxInput");
var searchBox = document.getElementById("Input");

searchBox.addEventListener("keyup", function copyInput(event) {
      searchFauxInput.textContent = searchBox.value;
      searchBox.setAttribute("value", searchBox.value);
}, false);

//searchBox.focus();
              
            
!
999px

Console