I am using HTML5 boilerplate and Bootstrap to create a website.
I am looking to make the orange and grey banner fixed on scroll but also centered and responsive. At the moment it is fixed on scroll and responsive but NOT CENTERED.
How can i make this element:
- FIXED ON SCROLL
- RESPONSIVE
- CENTRED
Bare in mind that i still want the slider to appear behind the banner as is.
Here is my code for this bit:
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<div class="nav-collapse collapse">
<ul class="nav pull-right" id="nav-links">
<li class="active">HOME</li>
<li>ABOUT</li>
<li>CONTACT</li>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
<div class="span12"> <!--THIS IS THE IMAGE I AM USING-->
<img src="images/PBP_header.png"/>
</div>
</div>
My dev site is: http://dev.paperboyposse.com
Thanks in advance guys!
Ash
Just replace
<div class="span12">
<img src="images/PBP_header.png">
</div>
with
<div class="container">
<div class="span12">
<img src="images/PBP_header.png">
</div>
</div>
It should be fixed, responsive and centered now :)
NOTE : I am not considering the slider as part of header btw.
Related
Hello im trying to put my content area to the right of my vertical nav bar using bootstrap 4. in my current code the content area is under the menu. any suggestions on how to fix it so its next to the menu on the right side.
Thank you
<div class="container-fluid">
<div class="col-3">
<nav class="navbar navbar-expand-sm bg-dark navbar-dark">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-
target="#collapsibleNavbar" aria-expanded="true">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse show" id="collapsibleNavbar" style>
<ul class="navbar.flex-column">
<li class="nav-item">
<a class="nav-link" href="index.html">Index</a>
</li>
</ul>
</div>
</nav>
</div>
</div>
<div class="container-fluid">
<div class="col-9">
<p>Main Content area</p>
</div>
</div>
Copy the col-9 div and place it after the col-3 div ends. Add d-flex flex-row classes with container-fluid class.
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 new to Stack Overflow so please forgive me if this is a repeat question. I searched thoroughly, but could not figure this out.
I am building a zipline portfolio page using mostly Bootstrap v3.3.6 and cannot get my section links to navigate properly.
Here is a sample of my markup including the nav:
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<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="#">Matthew Shelbourn</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li class="active">Bio</li>
<li>Projects</li>
<li>Gallery</li>
<li>Contact</li>
</ul>
</div>
</div>
</div>
<!-- Body Section1 -->
<div>
<a name="bio"></a>
</div>
<div class="container" style="background-color:cadetblue;">
<div class="row">
<div class="col-xs-12 col-md-4">
<span><img id="profile-image" class="img-responsive pull-left" style="margin-top: 4.1%; margin-bottom:4.1%;" src="#"></span>
</div>
When I click on the link in my nav for "Bio" (or any of the other sections) it doesn't navigate to the top of the corresponding section. Instead, it navigates to an area about 1/3 of the way down from the top of the section.
This same issue happens with every section link I have. I'm sure it's something trivial, but what am I doing wrong? Thanks!
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;.
Here is the code for navbar
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<!-- Be sure to leave the brand out there if you want it shown -->
<a class="brand" href="index.html">EasyUniv</a>
<!-- Everything you want hidden at 940px or less, place within here -->
<div class="nav-collapse collapse">
<ul class="nav">
<li class="active">
Home
</li>
<li>Services</li>
<li>Campus</li>
<li>Advertise</li>
</ul>
</div>
</div>
</div>
</div>
The example is at: www.easyuniv.com/staging
when you make the screen smaller it hides the nav buttons correctly but they do not go into the little drop down like it should. also at certain widths there is weird padding.. been trying different things and can't get these to work.
Thanks
You need to include jQuery before bootstrap.