html - Background Image in Bootstrap -
i have tried out following code , reason background image doesn't take whole page , covers navigation bar. should change in following code? how can make navigation bar span whole width of web page?
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>example of bootstrap 3 static navbar</title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> <style type="text/css"> .bs-example{ margin: 20px; } </style> </head> <body> <div class="container" style="background-image:url('tp.jpg');"> <div class="bs-example"> <nav id="mynavbar" class="navbar navbar-inverse"> <div class="container-fluid"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <span class="sr-only">toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="#">tnp</a> </div> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <ul class="nav navbar-nav"> <li><a href="#">home</a></li> <li class="dropdown"> <a href="#" data-toggle="dropdown" class="dropdown-toggle">companies<b class="caret"></b></a> <ul class="dropdown-menu"> <li class="dropdown"> <li><a href="#">rakuten</a></li> <li><a href="#">morgan stanley</a></li> <li><a href="#">tcs</a></li> <li><a href="#">nvidia</a></li> </ul> </li> <li class="dropdown"> <a href="#" data-toggle="dropdown" class="dropdown-toggle">student <b class="caret"></b></a> <ul class="dropdown-menu"> <li><a href="#">login</a></li> <li><a href="#">drafts</a></li> <li><a href="#">sent items</a></li> <li class="divider"></li> <li><a href="#">trash</a></li> </ul> </li> </div> </div> </nav> </div> </div> </body> </html>
use class container-fluid
instead of container
make use entire width.
and container needs given height. grow add more elements inside it.
here's fiddle.
Comments
Post a Comment