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

              
                <body class="dark-mode flex align-center justify-center">
	<div class="grid columns-2">
		<header class="span-all flex align-center space-between">
			<h1><code>box-shadow</code> Examples</h1>
			<a class="wl-button small icon" href="https://xhynk.com/" target="_blank">Made with 💖 by @Xhynk <i data-feather="chevron-right"></i></a>
		</header>
		<div class="wl-modal visible warning stark">
			<header class="flex space-between">
				<h4 class="flex align-center">
					<div class="icon"><i data-feather="frown"></i></div>
					<span>Stark Shadow</span>
				</h4>
			</header>
			<div class="content">This block has a very stark shadow. It's very bold and abrupt. It certainly has its place, but it doesn't look great on elements like this. Let's keep going.</div>
			<pre>box-shadow: 0 12px 20px #000;</pre>
		</div>
		<div class="wl-modal visible warning color">
			<header class="flex space-between">
				<h4 class="flex align-center">
					<div class="icon"><i data-feather="meh"></i></div>
					<span>Colored Shadow</span>
				</h4>
			</header>
			<div class="content">This block has a colored shadow that is a hex color based on the element itself and the background. This looks alright, but it will look bad if we have it on a different colored background</div>
			<pre>box-shadow: 0 12px 20px #1b1e20;</pre>
		</div>
		<div class="wl-modal visible alpha">
			<header class="flex space-between">
				<h4 class="flex align-center">
					<div class="icon"><i data-feather="smile"></i></div>
					<span>Alpha Shadow</span>
				</h4>
			</header>
			<div class="content">This block uses RGBA instead of a Hex color value to lighten the shadow. This works well to soften it, regardless of the background color - so it looks decent just about anywhere, and doesn't need modification.</div>
			<pre>box-shadow: 0 12px 20px rgba(0,0,0,.35);</pre>
		</div>
		<div class="wl-modal visible success subtle">
			<header class="flex space-between">
				<h4 class="flex align-center">
					<div class="icon"><i data-feather="award"></i></div>
					<span>Subtle Shadow</span>
				</h4>
			</header>
			<div class="content">This block makes use of <code>box-shadow</code>'s optional 4th argument, the "spread radius" or "choke". A positive value increases the spread, making it bolder. A negative value lowers the spread, making it more subtle! (keep in mind this will affect the border-radius of the shadow in relation to the element!)</div>
			<pre>box-shadow: 0 12px 24px -20px #000;</pre>
		</div>
		<div class="span-all text-center">
			<a href="https://developer.mozilla.org/en-US/docs/Web/CSS/box-shadow" target="_blank" class="wl-button secondary icon">Read More on MDN <i data-feather="external-link"></i></a>
		</div>
		<div class="wl-modal visible inset">
			<header class="flex space-between">
				<h4 class="flex align-center">
					<div class="icon"><i data-feather="plus-circle"></i></div>
					<span>Inset Shadow</span>
				</h4>
			</header>
			<div class="content">This block uses the <code>inset</code> value to invert the shadow and apply it <em>inside</em> the element instead of outside. The same subtlety principles apply here.</div>
			<pre>box-shadow: inset 6px 6px 16px -12px #000;</pre>
		</div>
		<div class="wl-modal visible multi">
			<header class="flex space-between">
				<h4 class="flex align-center">
					<div class="icon"><i data-feather="plus-circle"></i></div>
					<span>Multi Shadow</span>
				</h4>
			</header>
			<div class="content">You can chain together multiple box-shadows by comma separating them. This works with standard <em>and</em> inset shadows. Just… don't go <strong>too</strong> crazy…</div>
			<pre>box-shadow: -16px -16px 0 rgba(0,138,255,.2),
            inset 4px 4px 8px rgba(0,0,0,.5),
            0 0 0 3px #0095ee,
            16px 16px 0 rgba(255,255,255,.2);</pre>
		</div>
		<div class="nm-block span-all no-select">
			<div class="re-center">
				<div class="wl-modal visible neumorphic">
					<header class="flex space-between">
						<h4 class="flex align-center">
							<div class="icon"><i data-feather="power"></i></div>
							<span>Neumorphism</span>
						</h4>
					</header>
					<div class="content">With a little finagling, two box shadows (and sometimes a linear-gradient on the element), we can achieve a nice <a href="https://uxdesign.cc/neumorphism-in-user-interfaces-b47cef3bf3a6" target="_blank">"Neumorphism"</a> effect. This one does work best when using colored shadows to more closely match the background element, as you can't quite achieve a natural look with just the opacity of pure black.
						<p><strong>(Tip: Hover/click/tap on me!)</strong></p></div>
					<pre>background: linear-gradient(145deg, #272c31, #202529);
box-shadow: 30px 30px 60px #1e2227,
            -30px -30px 60px #2a3035;</pre>
				</div>
			</div>
		</div>
		<div class="wl-modal visible default span-all">
			<header class="flex space-between">
				<h4 class="flex align-center">
					<div class="icon"><i data-feather="sun"></i></div>
					<span>Bonus!</span>
				</h4>
			</header>
			<div class="content">If you don't specify a color for your box shadow, it will default to the current <code>color</code> for that element (that's the <em>text color!</em>)</div>
			<pre>box-shadow: 0 12px 24px;</pre>
		</div>
	</div>
	<div class="easy-edit">
		<a href="https://codepen.io/xhynk/pen/XWdOBwm/?editors=1100" target="_blank" class="wl-button primary small icon">Edit this Pen <i data-feather="edit"></i></a>
</body>
              
            
!

CSS

              
                .stark   { box-shadow: 0 12px 20px #000; }
.color   { box-shadow: 0 12px 20px #161f2d; }
.alpha   { box-shadow: 0 12px 20px rgba(0,0,0,.35); }
.subtle  { box-shadow: 0 12px 24px -20px #000; }
.inset   { box-shadow: inset 0 6px 14px -6px #000; }
.multi   { box-shadow: -16px -16px 0 rgba(0,138,255,.2), inset 4px 4px 8px rgba(0,0,0,.5), 0 0 0 3px #0095ee, 16px 16px 0 rgba(255,255,255,.2); }
.default { box-shadow: 0 12px 24px; }

.neumorphic {
	border-radius: 30px;
	background-color: #24292e;
	background: linear-gradient(145deg, #272c31, #202529) !important;
	box-shadow: 30px 30px 60px #1e2227, -30px -30px 60px #2a3035;
	
	&:hover {
		cursor: pointer;
		background: linear-gradient(145deg, #202529, #272c31) !important;
	}
	
	&:active {
		background: #24292e !important;
		box-shadow: inset 20px 20px 40px #1c2024, inset -20px -20px 40px #2c3238;
	}
}



/**
 * No need to look down here, this is just modifying the layout and such. Don't look at it, it's disgusting 🤮
 */
.no-select{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select: none;user-select: none;-webkit-tap-highlight-color:transparent;}.easy-edit{position:fixed;bottom:10px;right:10px;z-index:101;}.nm-block{padding:100px;text-align:center;position:relative;&:after{content:"";position:absolute;background:#24292e;left:-100vw;right:-100vw;height:180%;top:0}.re-center{margin:0 auto;max-width:calc(100vw - 80px)}}.default{margin-top:3em!important}a:not(.wl-button){text-decoration:none;font-weight:600;color:#0095ee;&:hover{color:#22b7ff!important}}::-webkit-scrollbar-track{-webkit-box-shadow:none;background-color:transparent}::-webkit-scrollbar{width:16px;background-color:transparent}::-webkit-scrollbar-thumb{background-color:#0095ee;-webkit-border-radius:8px;border-radius:8px;border:6px solid #262b31}body{background-image:linear-gradient(100deg,#24292e 70%,#20252a 70.1%,#20252a calc(70.1% + 30px),#336284 calc(70.1% + 31px))!important;background-repeat:no-repeat!important;background-size:cover!important;background-attachment:fixed!important}h1{margin:0}.wl-modal{position:relative;max-height:none;max-width:none;min-width:0;width:100%;overflow:visible;z-index:10;text-align:left}.grid{grid-gap:3em;width:calc(100% - 80px);max-width:980px;margin:40px 0}*{box-sizing:border-box}svg,svg *{box-sizing:content-box}pre,code{background:rgba(0,0,0,.2);padding:0 .5em;overflow:auto}pre{max-width:100%}@media all and (max-width:860px){.grid[class*="columns"]{grid-template-columns:100%}.wl-modal{margin:0 auto;max-width:100%}}@media all and (max-width:480px){.grid{width:calc(100% - 36px)}}@media all and (max-width:768px){.nm-block{padding:80px 10%;}}
              
            
!

JS

              
                feather.replace();

var urlParams = new URLSearchParams(window.location.search);
		editors   = urlParams.get('editors');
if( editors != null ){
	document.querySelector('.easy-edit').remove();
}
              
            
!
999px

Console