cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

Code Indentation

     

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.

            
              <header class="header-area overlay">
	<nav class="navbar navbar-expand-md navbar-dark">
		<div class="container">
			<a href="#" class="navbar-brand">Brand</a>
			
			<button type="button" class="navbar-toggler collapsed" data-toggle="collapse" data-target="#main-nav">
				<span class="menu-icon-bar"></span>
				<span class="menu-icon-bar"></span>
				<span class="menu-icon-bar"></span>
			</button>
			
			<div id="main-nav" class="collapse navbar-collapse">
				<ul class="navbar-nav ml-auto">
					<li><a href="#" class="nav-item nav-link active">Home</a></li>
					<li><a href="#" class="nav-item nav-link">About Us</a></li>
					<li class="dropdown">
						<a href="#" class="nav-item nav-link" data-toggle="dropdown">Services</a>
						<div class="dropdown-menu">
							<a href="#" class="dropdown-item">Dropdown Item 1</a>
							<a href="#" class="dropdown-item">Dropdown Item 2</a>
							<a href="#" class="dropdown-item">Dropdown Item 3</a>
						</div>
					</li>
					<li class="dropdown">
						<a href="#" class="nav-item nav-link" data-toggle="dropdown">Portfolio</a>
						<div class="dropdown-menu">
							<a href="#" class="dropdown-item">Dropdown Item 1</a>
							<a href="#" class="dropdown-item">Dropdown Item 2</a>
							<a href="#" class="dropdown-item">Dropdown Item 3</a>
							<a href="#" class="dropdown-item">Dropdown Item 4</a>
							<a href="#" class="dropdown-item">Dropdown Item 5</a>
						</div>
					</li>
					<li><a href="#" class="nav-item nav-link">Contact</a></li>
				</ul>
			</div>
		</div>
	</nav>
	
	<div class="banner">
		<div class="container">
			<h1>Bootstrap 4 Navbar</h1>
			<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec elit ex. Etiam elementum lectus et tempor molestie.</p>
			<a href="#content" class="button button-primary">Learn More</a>
		</div>
	</div>
</header>

<main>
	<section id="content" class="content">
		<div class="container">
			<div class="row">
				<div class="col-md-4">
					<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec elit ex. Etiam elementum lectus et tempor molestie. Pellentesque vestibulum dui sit amet dui volutpat sollicitudin. Etiam non erat finibus, iaculis nunc vel, convallis eros. Etiam efficitur tempor dui, vitae fringilla ipsum tristique quis. Aliquam erat volutpat. Cras ullamcorper ex et viverra vulputate. Nam lectus ligula, pretium nec risus nec, ultricies fringilla mauris. Proin quis venenatis neque, iaculis porta nulla. </p>
				</div>
				<div class="col-md-4">
					<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec elit ex. Etiam elementum lectus et tempor molestie. Pellentesque vestibulum dui sit amet dui volutpat sollicitudin. Etiam non erat finibus, iaculis nunc vel, convallis eros. Etiam efficitur tempor dui, vitae fringilla ipsum tristique quis. Aliquam erat volutpat. Cras ullamcorper ex et viverra vulputate. Nam lectus ligula, pretium nec risus nec, ultricies fringilla mauris. Proin quis venenatis neque, iaculis porta nulla. </p>
				</div>
				<div class="col-md-4">
					<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec elit ex. Etiam elementum lectus et tempor molestie. Pellentesque vestibulum dui sit amet dui volutpat sollicitudin. Etiam non erat finibus, iaculis nunc vel, convallis eros. Etiam efficitur tempor dui, vitae fringilla ipsum tristique quis. Aliquam erat volutpat. Cras ullamcorper ex et viverra vulputate. Nam lectus ligula, pretium nec risus nec, ultricies fringilla mauris. Proin quis venenatis neque, iaculis porta nulla. </p>
				</div>
			</div>
		</div>
	</section>
</main>
            
          
!
            
              @import url('https://fonts.googleapis.com/css?family=Open+Sans:400,700,800');
@import url('https://fonts.googleapis.com/css?family=Lobster');

$white: #FFF;
$primary: #C0CA33;
$overlay: rgba(0, 0, 0, .3);
$navbar: rgba(0, 0, 0, .9);

@mixin translateY($posY) {
	-webkit-transform: translateY($posY);
	-ms-transform: translateY($posY);
	transform: translateY($posY);
}

@mixin translateYAndRotate($posY, $rot) {
	-webkit-transform: translateY($posY) rotate($rot);
	-ms-sform: translateY($posY) rotate($rot);
	transform: translateY($posY) rotate($rot);
}

@mixin scaleX($scaleX) {
	-webkit-transform: scaleX($scaleX);
	-ms-transform: scaleX($scaleX);
	transform: scaleX($scaleX);
}

@mixin scaleY($scaleY) {
	-webkit-transform: scaleY($scaleY);
	-ms-transform: scaleY($scaleY);
	transform: scaleY($scaleY);
}

html {
	font-size: 62.5%;
}

body {
	font-family: 'Open Sans', sans-serif;
	font-size: 1.6rem;
	font-weight: 400;
}

h1 {
	margin-bottom: .5em;
	font-size: 3.6rem;
}

p {
	margin-bottom: .5em;
	font-size: 1.6rem;
	line-height: 1.6;
}

.button {
	display: inline-block;
	margin-top: 20px;
	padding: 8px 25px;
	border-radius: 4px;
}

.button-primary {
	position: relative;
	background-color: $primary;
	color: $white;
	font-size: 1.8rem;
	font-weight: 700;
	transition: color .3s ease-in;
	z-index: 1;
	
	&:hover {
		color: $primary;
		text-decoration: none;
	}
	
	&::after {
		content: '';
		position: absolute;
		bottom: 0;
		left: 0;
		right: 0;
		top: 0;
		background-color: $white;
		border-radius: 4px;
		opacity: 0;
		@include scaleX(.8);
		transition: all .3s ease-in;
		z-index: -1;
	}
	
	&:hover::after {
		opacity: 1;
		@include scaleX(1);
	}
}

.overlay::after {
	content: '';
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	top: 0;
	background-color: $overlay;
}

.header-area {
	position: relative;
	height: 100vh;
	background: url('https://picsum.photos/1920/1080?image=888');
	background-attachment:fixed;
	background-position: center center;
	background-repeat: no-repear;
	background-size: cover;
}

.banner {
	display: flex;
	align-items: center;
	position: relative;
	height: 100%;
	color: $white;
	text-align: center;
	z-index: 1;
	
	h1 {
		font-weight: 800;
	}
	
	p {
		font-weight: 700;
	}
}

.navbar {
	position: absolute;
	left: 0;
	top: 0;
	padding: 0;
	width: 100%;
	transition: background .6s ease-in;
	z-index: 99999;
	
	.navbar-brand {
		font-family: 'Lobster', cursive;
		font-size: 2.5rem;
	}
	
	.navbar-toggler {
		position: relative;
		height: 50px;
		width: 50px;
		border: none;
		cursor: pointer;
		outline: none;
		
		.menu-icon-bar {
			position: absolute;
			left: 15px;
			right: 15px;
			height: 2px;
			background-color: $white;
			opacity: 0;
			@include translateY(-1px);
			transition: all .3s ease-in;
			
			&:first-child {
				opacity: 1;
				@include translateYAndRotate(-1px, 45deg);
			}
			
			&:last-child {
				opacity: 1;
				@include translateYAndRotate(-1px, 135deg);
			}
		}
		
		&.collapsed .menu-icon-bar {
			opacity: 1;
			
			&:first-child {
				@include translateYAndRotate(-7px, 0)
			}
			
			&:last-child {
				@include translateYAndRotate(5px, 0);
			}
		}
	}
	
	&-dark .navbar-nav .nav-link {
		position: relative;
		color: $white;
		font-size: 1.6rem;
		
		&:focus, &:hover {
			color: $white;
		}
	}
	
	.dropdown-menu {
		padding: 0;
		background-color: $navbar;
		
		.dropdown-item {
			position: relative;
			padding: 10px 20px;
			color: $white;
			font-size: 1.4rem;
			border-bottom: 1px solid rgba(255, 255, 255, .1);
			transition: color .2s ease-in;
			
			&:last-child {
				border-bottom: none;
			}
			
			&:hover {
				background: transparent;
				color: $primary;
			}
			
			&::before {
				content: '';
				position: absolute;
				bottom: 0;
				left: 0;
				top: 0;
				width: 5px;
				background-color: $primary;
				opacity: 0;
				transition: opacity .2s ease-in;
			}
			
			&:hover::before {
				opacity: 1;
			}
		}
	}
	
	&.fixed-top {
		position: fixed;
		-webkit-animation: navbar-animation .6s;
		animation: navbar-animation .6s;
		background-color: $navbar;
		
		&.navbar-dark .navbar-nav .nav-link {
			&.active {
				color: $primary;
			}
			
			&::after {
				background-color: $primary;
			}
		}
	}
}

.content {
	padding: 120px 0;
}

@media screen and (max-width: 768px) {
	.navbar-brand {
		margin-left: 20px;
	}
	
	.navbar-nav {
		padding: 0 20px;
		background-color: $navbar;
	}
	
	.navbar.fixed-top .navbar-nav {
		background: transparent;
	}
}

@media screen and (min-width: 767px) {	
	.banner {
		padding: 0 150px;
		
		h1 {
			font-size: 5rem;
		}
		
		p {
			font-size: 2rem;
		}
	}
	
	.navbar-dark .navbar-nav .nav-link {
		padding: 23px 15px;
		
		&::after {
			content: '';
			position: absolute;
			bottom: 15px;
			left: 30%;
			right: 30%;
			height: 1px;
			background-color: $white;
			@include scaleX(0);
			transition: transform .1s ease-in;
		}
		
		&:hover::after {
			@include scaleX(1);
		}
	}
	
	.dropdown-menu {
		min-width: 200px;
		-webkit-animation: dropdown-animation .3s;
		animation: dropdown-animation .3s;
		-webkit-transform-origin: top;
		-ms-transform-origin: top;
		transform-origin: top;
	}
}

@-webkit-keyframes navbar-animation {
	0% {
		opacity: 0;
		@include translateY(-100%);
	}
	
	100% {
		opacity: 1;
		@include translateY(0);
	}
}

@keyframes navbar-animation {
	0% {
		opacity: 0;
		@include translateY(-100%);
	}
	
	100% {
		opacity: 1;
		@include translateY(0);
	}
}

@-webkit-keyframes dropdown-animation {
	0% {
		@include scaleY(0);
	}
	
	75% {
		@include scaleY(1.1);
	}
	
	100% {
		@include scaleY(1);
	}
}

@keyframes dropdown-animation {
	0% {
		@include scaleY(0);
	}
	
	75% {
		@include scaleY(1.1);
	}
	
	100% {
		@include scaleY(1);
	}
}
            
          
!
            
              jQuery(function($) {
	$(window).on('scroll', function() {
		if ($(this).scrollTop() >= 200) {
			$('.navbar').addClass('fixed-top');
		} else if ($(this).scrollTop() == 0) {
			$('.navbar').removeClass('fixed-top');
		}
	});
	
	function adjustNav() {
		var winWidth = $(window).width(),
			dropdown = $('.dropdown'),
			dropdownMenu = $('.dropdown-menu');
		
		if (winWidth >= 768) {
			dropdown.on('mouseenter', function() {
				$(this).addClass('show')
					.children(dropdownMenu).addClass('show');
			});
			
			dropdown.on('mouseleave', function() {
				$(this).removeClass('show')
					.children(dropdownMenu).removeClass('show');
			});
		} else {
			dropdown.off('mouseenter mouseleave');
		}
	}
	
	$(window).on('resize', adjustNav);
	
	adjustNav();
});
            
          
!
999px
Loading ..................

Console