I'm new to Bootstrap and I'm using Bootstrap Studio to learn how to code.I have added a body background image and set the navbar background to none and that works fine.
I am facing a problem regarding the next components added, in this case a jumbotron and a button. Each one of these two components are going over the image set in the <body>
which is logical. What I want is to create a navbar transparent and to have a background image, but only for the jumbotron and the navbar. How can I achieve this?
Thanks and sorry for my english.
Here is the HTML code
<body>
<div>
<div class="jumbotron" id="first-jumbo">
<h1>Heading text</h1>
<p>Nullam id dolor id nibh ultricies vehicula ut id elit. Cras justo odio, dapibus ac facilisis in, egestas eget quam.</p>
<p><a class="btn btn-default" role="button" href="#">Learn more</a></p>
</div>
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header"><a href="#" class="navbar-brand navbar-link">brand </a>
<button data-toggle="collapse" data-target="#navcol-1" class="navbar-toggle collapsed"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button>
</div>
<div class="collapse navbar-collapse" id="navcol-1">
<ul class="nav navbar-nav">
<li role="presentation" class="active"><a href="#">first item</a></li>
<li role="presentation"><a href="#">second item</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">dropdown <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
<li class="divider"></li>
<li><a href="#">One more separated link</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
</div>
<button class="btn btn-default" type="button">Button</button>
<script src="assets/js/jquery.min.js"></script>
<script src="assets/bootstrap/js/bootstrap.min.js"></script>
</body>
Here is the CSS code
body {
background:url(../../assets/img/pexels-photo-294560.jpeg) no-repeat;
padding-top:100px;
background-size:cover;
}
.navbar {
background:none;
}
#first-jumbo {
text-align:center;
}
Here is a page preview
Try this:
body {
background:url(../../assets/img/pexels-photo-294560.jpeg) no-repeat !important;
padding-top:100px;
background-size:cover;
}
.navbar, #first-jumbo {
background: transparent !important;
}
#first-jumbo {
text-align:center;
}
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