For the life of me I can't determine where the white space between my nav and jumbotron is coming from, I have played with so many variables, but cant get it to go away. I made a cssdeck here http://cssdeck.com/labs/u6ws0ozl and my code is below (Bootstrap code omitted).
HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<link href="shift.css" rel="stylesheet">
<link href="http://s3.amazonaws.com/codecademy-content/courses/ltp/css/bootstrap.css" rel="stylesheet" />
<link href="style.css" rel="stylesheet" />
</head>
<body>
<nav class="navbar navbar-static-top" role="navigation">
<div class="container-fluid">
<!-- Collect the nav links, forms, and other content for toggling -->
<!-- <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> -->
<ul class="nav nav-pills pull-left">
<li class="active"><a href="#">Home</a></li>
<li><a href="#">About Us</a></li>
</ul>
<form class="navbar-form navbar-right navbar-custom pull-right" role="search">
<div class="form-group">
<input type="text" class="form-control" placeholder="Search">
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
<ul class="nav nav-pills pull-right">
<li><a href="#">Log In</a></li>
<li><a href="#">Help</a></li>
</ul>
<!-- </div> /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
<div class="jumbotron">
<div class="container">
<h1>Find a place to stay.</h1>
<p>Rent from people in over 34,000 cities and 192 countries.</p>
<a href="#">Learn More</a>
</div>
</div>
</body>
</html>
CSS:
@charset "UTF-8";
/* CSS Document */
.navbar {
background-color: #2c3e50;
}
.nav-pills {
padding-top: 20px;
padding-bottom: 20px;
padding-right: 15px;
padding-left: 15px;
/*background-color: #2c3e50;*/
/*background-color: #2ecc71;*/
}
.nav > li > a:hover,
.nav > li > a:focus {
text-decoration: none;
background-color: #2ecc71;
}
.nav-pills > li.active > a,
.nav-pills > li.active > a:hover,
.nav-pills > li.active > a:focus {
color: #fff;
background-color: #2ecc71;
}
.navbar-custom {
padding-top: 20px;
}
.nav a {
color: #fff;
font-size: 18px;
font-weight: bold;
font-family: 'Shift', sans-serif;
/*padding: 14px 14px;*/
text-transform: uppercase;
}
.nav li {
display: inline;
}
.jumbotron {
background-image:url('http://goo.gl/04j7Nn');
height: 500px;
}
.jumbotron .container {
margin-top: 0px;
position: relative;
top:100px;
}
.jumbotron h1 {
color: #fff;
font-size: 48px;
font-family: 'Shift', sans-serif;
font-weight: bold;
}
.jumbotron p {
font-size: 20px;
color: #fff;
}
.learn-more {
background-color: #f7f7f7;
}
.learn-more h3 {
font-family: 'Shift', sans-serif;
font-size: 18px;
font-weight: bold;
}
.learn-more a {
color: #00b0ff;
}
.neighborhood-guides {
background-color: #efefef;
border-bottom: 1px solid #dbdbdb;
}
.neighborhood-guides h2 {
color: #393c3d;
font-size: 24px;
}
.neighborhood-guides p {
font-size: 15px;
margin-bottom: 13px;
}
Jumbotron is a lightweight grey box for displaying the key contents of the websites. It increases the size of the contents. The previous version of Bootstrap 4 had a separate class to create a Jumbotron. But it has been removed in Bootstrap 5 as it can be created using classes of Bootstrap 5.
In Bootstrap 5 the jumbotron component is removed in favor of utility classes like . bg-light for the background color and .
A jumbotron indicates a big box for calling extra attention to some special content or information. A jumbotron is displayed as a grey box with rounded corners. It also enlarges the font sizes of the text inside it. Tip: Inside a jumbotron you can put nearly any valid HTML, including other Bootstrap elements/classes.
You can change your . jumbotron height using @media() queries to reflect major screen sizes. At some point, you will overflow the image but at least it won't be by much because you have established that the . jumbotron won't go too far from the 2:1 ratio.
Remove the following from css/bootstrap.css
.navbar{
margin-bottom: 20px;
}
Or you can also override it by adding margin:0;
to your own css file:
.navbar {
background-color: #2c3e50;
margin:0; /*add this*/
}
Live demo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With