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

              
                <main class="d-flex justify-content-center align-items-center py-4">
	<div class="container text-white">
		<section>
			<div class="row">
				<div class="col-6">
					<div>
						<h1>Lorem ipsum dolor sit amet.</h1>
						<p>Lorem ipsum dolor, sit amet consectetur adipisicing <br> elit. Voluptas corrupti ducimus maxime, rem quibusdam sit.</p>
						<a href="#">Read more</a>
					</div>
				</div>
				<div class="col-6">
					<div>
						<h1>Lorem ipsum dolor sit amet.</h1>
						<p>Lorem ipsum dolor, sit amet consectetur adipisicing <br> elit. Voluptas corrupti ducimus maxime, rem quibusdam sit.</p>
						<a href="#">Read more</a>
					</div>
				</div>
				<div class="col-6">
					<div>
						<h1>Lorem ipsum dolor sit amet.</h1>
						<p>Lorem ipsum dolor, sit amet consectetur adipisicing <br> elit. Voluptas corrupti ducimus maxime, rem quibusdam sit.</p>
						<a href="#">Read more</a>
					</div>
				</div>
				<div class="col-6">
					<div>
						<h1>Lorem ipsum dolor sit amet.</h1>
						<p>Lorem ipsum dolor, sit amet consectetur adipisicing <br> elit. Voluptas corrupti ducimus maxime, rem quibusdam sit.</p>
						<a href="#">Read more</a>
					</div>
				</div>
				<div class="col-6">
					<div>
						<h1>Lorem ipsum dolor sit amet.</h1>
						<p>Lorem ipsum dolor, sit amet consectetur adipisicing <br> elit. Voluptas corrupti ducimus maxime, rem quibusdam sit.</p>
						<a href="#">Read more</a>
					</div>
				</div>
				<div class="col-6">
					<div>
						<h1>Lorem ipsum dolor sit amet.</h1>
						<p>Lorem ipsum dolor, sit amet consectetur adipisicing <br> elit. Voluptas corrupti ducimus maxime, rem quibusdam sit.</p>
						<a href="#">Read more</a>
					</div>
				</div>
			</div>
		</section>
	</div>
</main>
              
            
!

CSS

              
                * {
	margin: 0;
	padding: 0;
	outline: 0;
	box-sizing: border-box;
	font-family: 'Roboto', sans-serif;
}

main {
	width: 100%;
	background: url(https://images.pexels.com/photos/5797902/pexels-photo-5797902.jpeg?auto=compress&cs=tinysrgb&dpr=3&h=750&w=1260) no-repeat bottom center / cover;
	
	overflow: hidden;  /* IMPORTANT */
}

main > .container {
	background: rgba(0,0,0,.5);
}

main > .container section .col-6 > div {
	padding: 10px;
	background: rgba(255,255,255,.1);
	margin: 15px 0;
	border-radius: 5px;
}
main > .container > section {
	padding: 20px 15px;
}

section h1 {
	font-size: 24px;
	font-weight: 700;
}

section p {
	font-size: 15px;
	line-height: 25px;
	font-weight: 500;
}

section a {
	text-decoration: none !important;
	display: block;
	padding: 8px 5px;
	text-align: center;
	border-radius: 3px;
	background: #fff;
	font-size: 14px;
	font-weight: 700;
	color: #232323 !important;
	
	position: relative;
	z-index: 1;
}

/* ========================= */
/* OUR CODE WILL START FROM HERE
/* ========================= */

main > .container,
main > .container > section {
	position: relative;
	z-index: 1;
}

/* These 2 are for left and right side of the container */
main > .container::before,
main > .container::after {
	position: absolute;
	content: '';
	background: rgba(0,0,0,.6);
	z-index: -1;
	
	/* here is the trick */
	width: 100vw;
	height: calc(100% + 20px);
	top: -10px;
}

/* lef side */
main > .container::before { right: calc(100% + 10px); } 

/* right side */
main > .container::after { left: calc(100% + 10px); }


/* these 2 are for top and bottom side of the container */
main > .container > section::before,
main > .container > section::after {
	position: absolute;
	content: '';
	width: 100vw;
	height: 100%;
	left: 50%;
	transform: translateX(-50%);
	background: rgba(0,0,0,.6);
	z-index: -1;
}
main > .container > section::before { 
	bottom: calc(100% + 10px); /* top side */
} 
main > .container > section::after { 
	top: calc(100% + 10px); /* bottom side */
}
              
            
!

JS

              
                
              
            
!
999px

Console