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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

              
                <main>
	<h1>CSS <code>scrollbar-gutter</code></h1>
	<section>
		<div>
			<div class="controlline"></div>
			<p class="description"><code>overflow: auto;<br />scrollbar-gutter: auto;</code></p>
			<div class="header">HEADER</div>
			<div class="box overflow-auto scrollbar-gutter-auto">
				<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut suscipit nisi id mattis laoreet. Praesent mattis elit in vulputate facilisis. Phasellus porta dui at commodo faucibus.</p>
			</div>
		</div>
		<div>
			<div class="controlline"></div>
			<p class="description"><code>overflow: auto;<br />scrollbar-gutter: stable;</code></p>
			<div class="header">HEADER</div>
			<div class="box overflow-auto scrollbar-gutter-stable">
				<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut suscipit nisi id mattis laoreet. Praesent mattis elit in vulputate facilisis. Phasellus porta dui at commodo faucibus.</p>
			</div>
		</div>
		<div>
			<div class="controlline"></div>
			<p class="description"><code>overflow: auto;<br />scrollbar-gutter: stable both-edges;</code></p>
			<div class="header">HEADER</div>
			<div class="box overflow-auto scrollbar-gutter-stable-both">
				<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut suscipit nisi id mattis laoreet. Praesent mattis elit in vulputate facilisis. Phasellus porta dui at commodo faucibus.</p>
			</div>
		</div>
		<div>
			<p class="description"><code>overflow: auto;<br />scrollbar-gutter: auto;</code></p>
			<div class="header">HEADER</div>		
			<div class="box overflow-auto scrollbar-gutter-auto">
				<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut suscipit nisi id mattis laoreet. Praesent mattis elit in vulputate facilisis. Phasellus porta dui at commodo faucibus. Nunc id dui vitae turpis gravida euismod non a augue. Sed faucibus quam eget enim tincidunt, eu lobortis dui sollicitudin. Etiam tincidunt purus vitae lacus lacinia volutpat. Vivamus sodales dui in dui rhoncus posuere. Curabitur tempus feugiat libero, id accumsan enim scelerisque id. Praesent malesuada diam turpis, eu lobortis risus lobortis et. Phasellus condimentum egestas nulla quis efficitur. Praesent bibendum enim et libero ornare facilisis non at ipsum.</p>
			</div>
		</div>
		<div>
			<p class="description"><code>overflow: auto;<br />scrollbar-gutter: stable;</code></p>
			<div class="header">HEADER</div>
			<div class="box overflow-auto scrollbar-gutter-stable">
				<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut suscipit nisi id mattis laoreet. Praesent mattis elit in vulputate facilisis. Phasellus porta dui at commodo faucibus. Nunc id dui vitae turpis gravida euismod non a augue. Sed faucibus quam eget enim tincidunt, eu lobortis dui sollicitudin. Etiam tincidunt purus vitae lacus lacinia volutpat. Vivamus sodales dui in dui rhoncus posuere. Curabitur tempus feugiat libero, id accumsan enim scelerisque id. Praesent malesuada diam turpis, eu lobortis risus lobortis et. Phasellus condimentum egestas nulla quis efficitur. Praesent bibendum enim et libero ornare facilisis non at ipsum.</p>
			</div>
		</div>
		<div>
			<p class="description"><code>overflow: auto;<br />scrollbar-gutter: stable both-edges;</code></p>
			<div class="header">HEADER</div>
			<div class="box overflow-auto scrollbar-gutter-stable-both">
				<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut suscipit nisi id mattis laoreet. Praesent mattis elit in vulputate facilisis. Phasellus porta dui at commodo faucibus. Nunc id dui vitae turpis gravida euismod non a augue. Sed faucibus quam eget enim tincidunt, eu lobortis dui sollicitudin. Etiam tincidunt purus vitae lacus lacinia volutpat. Vivamus sodales dui in dui rhoncus posuere. Curabitur tempus feugiat libero, id accumsan enim scelerisque id. Praesent malesuada diam turpis, eu lobortis risus lobortis et. Phasellus condimentum egestas nulla quis efficitur. Praesent bibendum enim et libero ornare facilisis non at ipsum.</p>
			</div>
		</div>
	</section>
</main>

<div class="warning">⚠️ Your browser does not support CSS <code>scrollbar-gutter</code>, so this demo won't work. If you're feeling adventurous use Chromium 88+ with “Experimental Web Platform Features” enabled.</div>
              
            
!

CSS

              
                body {
	max-width: 74em;
	width: 74em;
	margin: 0 auto;
	text-align: center;
}

section {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 1em 2em;
	padding: 2em;
	background: hsl(228deg 55% 84%);
	margin: 3em 0;
}

.controlline {
	position: fixed;
	width: 0px;
	height: 1000px;
	border: 1px solid red;
	left: 100px;
}

.description {
	text-align: center;
	font-weight: 700;
	margin-bottom: 0.5rem;
}

.box {
	height: 12em;
	background: hsl(228deg 55% 96%);
	text-align: justify;
}

.box > * {
	margin: 0;
}

.box > p {
	width: 21em;
	margin: auto;
}

.header {
	width: 21em;
	display: block;
	background-color: lightgrey;
	margin: auto;
}

.overflow-auto {
	overflow: auto;
}

.overflow-hidden {
	overflow: hidden;
}

.scrollbar-gutter-auto {
	scrollbar-gutter: auto;
}

.scrollbar-gutter-stable {
	scrollbar-gutter: stable;
}

.scrollbar-gutter-stable-both {
	scrollbar-gutter: stable both-edges;
}


/* Show warning for older browser */
.warning {
  position: fixed;
  bottom: 3em;
  right: 1em;
  left: 1em;
  padding: 1em;
  border: 1px solid black;
  z-index: 9999;
  text-align: center;
  color: black;
  background: rgba(255 255 225 / 0.9);
}

.warning a {
  color: blue;
}

@supports(scrollbar-gutter: auto) {
	.warning {
		display: none;
	}
}
              
            
!

JS

              
                (function (){
	
	let tests = document.querySelectorAll('section > div');
	let testsArray = Array.from(tests);
	let testsArrayFiltered = testsArray.filter((curr) => curr.querySelector('.controlline'));
	console.log(testsArrayFiltered);
	testsArrayFiltered.forEach((curr) => {
		let header = curr.querySelector('.header');
		let controlline = curr.querySelector('.controlline');
		let headerRect = header.getBoundingClientRect();
		let left = headerRect.x + headerRect.width;
		console.log(left);
		controlline.style.left = left + "px";
	});
})();
              
            
!
999px

Console