I'm trying to create a layout using jumbotron and navbar but I cannot do it. I want that the jumbotron is located on top and the navbar is under of it. After I created I don't know why it has space on top and between the navbar.
How do I fix this ?
trying
<!-- Header.cshtml to use as a Partial to include on main layout -->
<header class="jumbotron bg-red">
<h1>My first layout</h1>
<h3>Trying to create a layout using jumbotron and navbar</h3>
</header><!--jumbotron-->
<div class="navbar navbar-inverse navbar-static-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<img src="~/Imagens/logo.png" width="32" height="32" title="Red Cherry" />
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>#Html.ActionLink("Home", "Index", "Home")</li>
<li>#Html.ActionLink("About", "About", "Home")</li>
<li>#Html.ActionLink("Contact", "Contact", "Home")</li>
</ul>
#Html.Partial("_LoginPartial")
</div>
</div>
</div><!--nav bar-->
Not sure why you having this issue, have you changed anything in the bootstrap css?
For a quick fix you can do some css, add a class 'remove-space' to the header tag.
<header class="jumbotron bg-red remove-space">
Then apply this css to it.
.remove-space{
margin: -50px 0 0 0;
}
Related
I would like my navbar to be divided into 12 sections with each element taking up 1 section, i.e have 12 elements in the navbar. I would also like them to start from the very left of the screen, instead of what I currently have in the image below;
I thought container-fluid and navbar-left would align the elements fully to the left of the navbar but I am really struggling in trying to move them over.
What I Have Tried (my code so far)
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="container container-fluid">
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav navbar-left">
<li>Directories</li>
<li>Contracts</li>
<li>Processes</li>
<li>Filing</li>
<li>My Profile</li>
</ul>
</div>
</div>
</div>
#RenderBody()
</div>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
Am I able to A) Align all the elements in the navbar fully to the left and B) Divide the navbar into 12 "sections" that each element shall take one of?
I am using Bootstrap v3.3.7.
Add the row class to the container:
<div class="container container-fluid">
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container row">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav navbar-left">
<li>Directories</li>
<li>Contracts</li>
<li>Processes</li>
<li>Filing</li>
<li>My Profile</li>
</ul>
</div>
</div>
</div>
#RenderBody()
</div>
jsFiddle
A)
I think you have to take away the container class in the first line, like that:
<div class="container-fluid">
B)
You can add the col-md-1 Bootstrap class to the li elements, like that:
<li class="col-md-1">Directories</li>
If you inspect the navbar you created you will find some padding/margin left generated by bootstrap, just add your own class to that element and set margin or padding you want. You can create as many li elements as you want.
In the output below I can't see my navbar menu correctly. Where is the problem?
Please anyone help me.
I just changed my code bootstrap.css and make this line comment the line name: padding-bottom.
<nav class="navbar navbar-inverse" style="height:120px;">
<div class="container" style="padding-top:30px;">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a><img class="pull-left" src="images/mt-626_header_logo01.png"></a>
<a class="navbar-brand" href="#"><strong style="color:white">SOFT</strong><strong style="color:#3EC7C2">APP</strong></a>
</div>
<div class="collapse navbar-collapse" id="navbar">
<ul class="nav navbar-nav navbar-right">
<li>HOME</li>
<li>ABOUT</li>
<li>SERVICES</li>
<li>BLOG</li>
<li>CONTACTS</li>
</ul>
</div>
</div>
</nav>
<!-- First Container -->
<div class="container-fluid fcontaner">
<div class="row">
<div class="col-md-12">
<div class="col-md-6">
<img src="images/mt-0626-img.png" style="height:100%;width:100%"/>
</div>
<div class="col-md-6">
<h1 style="padding-top:150px"><strong style="color:white;">SOFT</strong><strong style="color:">APP</strong></h1>
<h1>INNOVATIVE SOLUTIONS</h1>
<h3 style="color:white;padding-bottom:50px;">Innovative solutions delivering a product, which <br>includes tomorrow’s technology – already today!</h3>
<img src="images/mt-0626-img2.png">
</div>
</div>
</div>
</div>
You can remove the height from the <nav class="navbar navbar-inverse" style="height:120px;"> if you want as suggested by Ismail.
But if you really want your nav to have a default height, then instead of height you can give min-height as <nav class="navbar navbar-inverse" style="min-height:120px;"> and it will work. Your nav will expand as the content in it increases in height.
Demo:http://www.bootply.com/0JiOM9OxYW
Remove the height and padding-top css.
You have added inline style here <nav class="navbar navbar-inverse" style="height:120px;"> just remove it your problem will solve.
See Demo
I am trying to add dropdown submenu to bootstrap menubar, Submenu appears as soon as i hover on the "people aspect".But when submenu appears it is extending the size of menubar. Is there any way the fix the size of the menubar
Here is the code
<div class="navbar navbar-inverse navbar-fixed-top" >
<div class="container" >
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div >
#* #Html.ActionLink("Application name", "Index", "Home", null, new { #class = "navbar-brand" })*#<img src="~/Images/InfosysLogo.png" style="height:70px;width:200px" />
</div>
</div>
<div class="navbar-collapse collapse">
<ul id="nav" class="nav navbar-nav">
<li>#Html.ActionLink("DashBoard", "ExecutiveDashboard", "Charts")</li>
<li>#Html.ActionLink("Engagement Metrics", "EngagementMatrix", "Charts")</li>
<li>#Html.ActionLink("Quality Metrics", "Contact", "Home")</li>
<li>
#Html.ActionLink("People Aspects", "Contact", "Home")
<ul id="subnav">
<li>#Html.ActionLink("Certifications", "Index", "Certification", new { #class = "my-class" })</li>
<li>#Html.ActionLink("Trainings", "Index", "Training", new { #class = "my-class" })</li>
</ul>
</li>
<li>#Html.ActionLink("Financials", "BudgetVSActualChart", "Financial")</li>
<li>#Html.ActionLink("Admin", "AdminView", "PMODashboard")</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="navbar-text">Hello, #User.Identity.Name!</li>
</ul>
</div>
</div>
</div>
<div class="container body-content">
Any help will be appreciable.
Thank you
example try this code of css and check
HTML
<div class="navbar navbar-inverse navbar-fixed-top" >
</div>
CSS
.navbar{
width:980px;
}
HTML
<div class="navbar navbar-inverse navbar-fixed-top" >
</div>
CSS
.navbar{
min-height:90px !important;
}
resolved my issue it set the min height to 90px so when i was hovering on menu item submenu items were not extending my menubar
I am fairly new to CSS and have a question I can't seem to figure out. So I just started a MVC application and I am trying to float a logo over the navigation menu bar. I got the logo into the position I want, but now the problem is that the navigation menu is covering over the top half of the logo. Is there anyway I can choose for the logo to be on top of the bar?
This is what my _Layout.cshtml looks like:
<body>
<div style="position: absolute; margin-top: -50px;">
<img src="~/Content/Images/IsabellasLogo.png" />
</div>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>#Html.ActionLink("Home", "Index", "Home")</li>
<li>#Html.ActionLink("Mission", "Mission", "Home")</li>
<li>#Html.ActionLink("Menu", "Menu", "Home")</li>
<li>#Html.ActionLink("Contact", "Contact", "Home")</li>
</ul>
</div>
</div>
</div>
<div class="container body-content">
#RenderBody()
<hr />
<footer>
<p>© Isabellas's Pizzeria</p>
</footer>
</div>
#Scripts.Render("~/bundles/bootstrap")
#RenderSection("scripts", required: false)
</body>
Your navbar is set to have navbar-fixed-top class, which probably defines position:fixed;. Try changing this to position:relative;. You might need to also adjust margins, but without seeing actual CSS its hard to tell.
Another option would be to leave position:fixed; intact, but adjust top:0 to something bigger, like top:50px;.
Using bootstrap v3.0
Id like to dynamically center the navigation bar. i.e. A fix that doesnt hardcode a width.
How is this achieved? Below is a sample of the standard navigation code with excess tags removed.
<!-- NAVBAR
================================================== -->
<div class="navbar-wrapper">
<div class="navbar navbar-inverse navbar-static-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">All Saints Church, Ripley.</a>
</div>
<div class="navbar-collapse collapse" >
<ul class="nav navbar-nav">
<li class="active">Home</li>
<li>About</li>
<li>Contact</li>
</ul>
</div>
</div>
</div>
</div>
<!-- ./NAVBAR -->
The documentation states to float the navbar right insert .navbar-right #<ul class="nav navbar-nav navbar-right"> ... shown here http://getbootstrap.com/components/#navbar-component-alignment.
Having followed the methodology of this question: twitter bootstrap -- center brand in nav bar I cannot centralize the navigation using margin-left: auto; and margin-right: auto;
Any help is greatly appreciated.
For the record, I don't quite like this solution =) But a brute force way may be to add the following CSS:
.nav.navbar-nav {
float: none;
margin-left: auto;
margin-right: auto;
}
and the following jQuery to force the width down from the auto that is being inherited from .container:
var width = 0, $navbarLinks = $(".nav.navbar-nav");
$navbarLinks.children().each( function(idx) {
width += $(this).outerWidth();
});
$navbarLinks.width(width);
See the jsFiddle for testing.
I have found it easiest to use the nav-justified class for this purpose..
<nav class="navbar navbar-default" role="navigation">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="navbar-collapse collapse">
<ul class="nav nav-justified">
<li class="active">Home</li>
<li>Projects</li>
<li>Services</li>
<li>Downloads</li>
<li>About</li>
<li>Contact</li>
</ul>
</div>
</nav>
Demo
You can also constrain the width using an extra class. See the 2nd navbar in the demo.