Bootstrap won't stop adding a second row to my navbar - html

I have the following HTML:
<nav class="navbar pr-navbar navbar-fixed-top" role="navigation">
<div class="navbar-header">
<div class="row">
<div class="navbar-left">
<a plat-tap='goBack()'><span class="fui-arrow-left pr-back"></span></a>
</div>
<div class="navbar-right">
<a plat-tap='goHome()'><span class="glyphicon glyphicon-home pr-home"></span></a>
</div>
<p class="pr-navbar-text">Manage/Add Users</p>
<div class="navbar-right">
<div class="pr-add-item">
<a plat-tap='addUser()'><span class="fui-plus"></span></a>
</div>
</div>
</div>
</div>
</nav>
Coupled with the following LESS:
#primaryColor: red;
#secondaryColor: blue;
#borderColor: white;
#textColor: white;
.pr-back{
color: #textColor;
}
.pr-home{
color: #textColor;
}
.pr-navbar-text{
color: #textColor;
text-align: center;
}
.pr-navbar {
background-color: #secondaryColor;
background-image: none;
background-repeat: no-repeat;
filter: none;
}
body { padding-top: 75px; }
#media screen and (max-width: 768px) {
body { padding-top: 53px; }
}
.pr-add-item {
padding-right: 75px
}
For some reason, the row element in my HTML does nothing. The plus icon is always put on a row beneath all the other buttons. How can I fix this so I have one row with a left aligned button, a center text, and two right aligned buttons?

Here, I started a fiddle for this.
JSFiddle here
<nav class="navbar pr-navbar navbar-fixed-top" role="navigation">
<div class="container-fluid">
<div class="nav navbar-nav navbar-left">
<a plat-tap='goBack()'><span class="fui-arrow-left pr-back"></span></a>
</div>
<div class="nav navbar-nav navbar-right">
<a plat-tap='goHome()'><span class="glyphicon glyphicon-home pr-home"></span></a>
</div>
<p class="nav navbar-nav pr-navbar-text">Manage/Add Users</p>
<div class="nav navbar-nav navbar-right">
<div class="pr-add-item">
<a plat-tap='addUser()'><span class="glyphicon glyphicon-plus"></span></a>
</div>
</div>
</div>
</nav>
This HTML is closer to what you want. There were some unnecessary tags included in your original HTML, and also some important tags (like nav and navbar-nav) that were excluded. I suggest you read over this section of the bootstrap components page to understand how to get NavBars to work more cooperatively.
(I changed the glyph for your plus button and back arrow button so something would show up without including flat ui).
Edit: Altered the JSFiddle so that the text could be centered in the navbar.

Related

Body content overlapping navbar while scrolling

I am facing an error while scrolling page, body contents overlaps the navbar.
I have content over navbar that should disappear when scrolling, it is working fine.
While scrolling navbar should be fixed, this is working fine.
Problem is while scrolling, body contents are sliding over navbar. It should go from behind the navbar.
I have an image slider below navbar
Here is the code of HTML file:
<div class="container-fluid" style="background-color:#F44336;color:#fff;height:200px;">
<div class="row">
<div class="col-sm-4" style="background-color:yellow; width:200px">
<img class="img-responsive img-rounded pull-left" src="img/logo 1.png" alt="Chania" width="200" height="200">
</div>
<div class="col-sm-4" style="background-color:pink;">
<h3>Fixed (sticky) navbar on scroll</h3>
<p>Scroll this page to see how the navbar behaves with data-spy="affix".</p>
<p>The navbar is attached to the top of the page after you have scrolled a specified amount of pixels.</p>
</div>
<div class="col-sm-4 text-right" style="background-color:yellow;width:200px;">
<img class="img-responsive img-rounded pull-right" src="img/logo 2.png" alt="Chania" width="200" height="200">
</div>
</div>
</div>
<nav class="navbar navbar-inverse" data-spy="affix" data-offset-top="197">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="container-fluid">
<div class="navbar-header">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Menu</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
menu name..
</ul>
<form class="navbar-form navbar-right" role="search">
<div class="form-group">
<input type="text" class="form-control" placeholder="Search">
</div>
<button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-search"></span></button>
</form>
</div>
</div>
</nav>
CSS code of navbar:
.affix {
top: 0;
width: 100%; }
.affix + .container-fluid {
padding-top: 70px; }
CSS code for Slider
html, body {
height: 100%;}
.carousel, .item {
height: 70%; }
.carousel-inner {
height: 143%; }
.fill {
width: 100%;
height: 100%;
background-position: center;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
-o-background-size: cover; }
I am beginner in bootstrap.
Thanks.
You should put this in a fiddle but off the bat I would guess that your navbar should contain position:absolute; and z-index:1;
On seeing this query i have made jsfiddle for you just check it.. You are using affix for fixing navbar.
so in css just add the followings:
.affix{
width:100%;
top:0px;
}
And check with the z-index of your navbar keep high value for nabvar like z-index:9999;
JSfiddle link
All the coding looks good no issue with that. Just check my fiddle
Adding margin-top:30px; in the main Container would do what you are asking.

How do I make the row element take up the entire width?

I am fairly new to bootstrap and I am trying to figure out some code for a test website. I have ran into an issue with bootstrap, I setup a element and put 2 elements into it. On the left is a paragraph (which I plan on changing to a larger element later), and on the right is an image (I don't think the dimensions matter). I noticed that the row element was not taking up full width of the screen and figured this was because of the elements it was inside of. I went into my CSS file to troubleshoot, set the row class' width to 100%, and went back to my site and opened up Chrome's dev tools. I noticed that the container div had a right and left margin on both sides which caused the row div to take up less space and center itself within the element of the container. I set both the left and right values for margin to 0px and went back to the site. The left margin had disappeared and although Chrome's inspect was showing there was no right margin either, it still appeared when I hovered over the container element. I don't think it is a specificity error as the left margin disappeared but not the right. I'm truly stumped. As I mentioned, I'm fairly new to Bootstrap so the issue may be in plain sight. I checked to make sure I typed all of my syntax correctly for margin right and it looked normal to me. The code I'm showing you, however, is without the modifications I made to the container and the row. The code I'm showing you is normal (apart from the container being centered).
If there are some odd spacing issues, I apologize. I manually spaced 4 times for each line of code so if there are 4 spaces where there shouldn't be, my apologies.
.header .jumbotron {
color: #fff;
background-color: #a1ff7c;
font-family: Roboto Condensed;
margin-bottom: 0px;
}
.navbar-default {
background-color: #78c45a;
border: 0px;
font-family: Roboto Condensed;
}
.gallery .container {
font-family: Roboto Condensed;
}
.navbar-default .navbar-nav > .active > a,
.navbar-default .navbar- nav > .active > a:focus {
color: white;
/*BACKGROUND color for active*/
background-color: #78c45a;
}
.navbar-default .navbar-nav > .active > a:hover {
background-color: #5a9344;
color: #fff;
}
.navbar-default .navbar-nav > li > a {
color: #fff;
}
.navbar-default .navbar-nav > li > a:hover {
color: #fff;
background-color: #5a9344;
}
.navbar-default .navbar-brand {
color: #fff;
}
.navbar-default .navbar-brand:hover {
background-color: #5a9344;
color: #fff;
}
.navbar-default .navbar-toggle .icon-bar {
background-color: #fff;
}
.navbar-default .navbar-toggle {
border: 0px;
}
.navbar-default .navbar-toggle:hover {
background-color: #5a9344;
;
}
p {
font-family: Roboto Condensed;
}
<html lang="en">
<head>
<title>Hope's Seed</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" h ref="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js">
</script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js">
</script>
<link href="CSS/style.css" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css? family=Roboto+Condensed" rel="stylesheet">
</head>
<body>
<div class="header">
<div class="jumbotron text-center">
<h1>Hope's Seed</h1>
<p>You're Not Alone</p>
</div>
</div>
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="hopesseed.html">Hope's Seed</a>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li>About
</li>
<li>Sponsors
</li>
<li>Donate
</li>
<li>Services
</li>
<li>More
</li>
</ul>
</div>
</div>
</nav>
<div class="Intro">
<div class="container">
<div class="row">
<div class="col-sm-6">
<p>Enriching the lives of children who are medically fragile and terminally ill.</p>
</div>
<div class="col-sm-3">
<img src="Images/image1.png" class="img-responsive">
</div>
</div>
</div>
</div>
<div class="gallery">
<div class="container">
<div class="row">
<div class="col-sm-4">
<h3>Family Support</h3>
<p>Hope's Seed is here to support you.</p>
</div>
<div class="col-sm-4">
<h3>Volunteer Opportunities</h3>
<p>Hope's Seed has many ways to volunteer.</p>
</div>
<div class="col-sm-4">
<h3>Giving Opportunities</h3>
<p>Enriching the lives of Texas children who are medically fragile and terminally ill.</p>
</div>
</div>
</div>
</div>
</body>
</html>
Try use 'container-fluid'
<title>Hope's Seed</title>
<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/3.1.1/jquery.min.js"> </script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"> </script>
<body>
<div class = "header">
<div class="jumbotron text-center">
<h1>Hope's Seed</h1>
<p>You're Not Alone</p>
</div>
</div>
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="hopesseed.html">Hope's Seed</a>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li>About</li>
<li>Sponsors</li>
<li>Donate</li>
<li>Services</li>
<li>More</li>
</ul>
</div>
</div>
</nav>
<div class="Intro">
<div class="container-fluid">
<div class="row">
<div class="col-sm-6">
<p>Enriching the lives of children who are medically fragile and terminally ill.</p>
</div>
<div class="col-sm-3">
<img src="Images/image1.png" class="img-responsive">
</div>
</div>
</div>
</div>
<div class = "gallery">
<div class="container-fluid">
<div class="row">
<div class="col-sm-4">
<h3>Family Support</h3>
<p>Hope's Seed is here to support you.</p>
</div>
<div class="col-sm-4">
<h3>Volunteer Opportunities</h3>
<p>Hope's Seed has many ways to volunteer.</p>
</div>
<div class="col-sm-4">
<h3>Giving Opportunities</h3>
<p>Enriching the lives of Texas children who are medically fragile and terminally ill.</p>
</div>
</div>
</div>
</div>
</body>
</html>
Live demo - https://jsfiddle.net/f39wurmn/1/
Hope this helps
set margin:0 for body in css. Some browsers has a default margin
body
{
margin:0;
}

Bootstrap Responsive Layout isn't working with Calc CSS function

I am building a webpage with HTML & CSS, using the bootstrap framework. It is based on the grid layout system. I would like to have my navbar and first row of my grid in a group and the second row in a group, where each group fills 100% of the screen height. I can't see how a div definition would work as it spans the middle of two div classes. I have tried this, using the calc function, but it doesn't seem to be working.
Here is a JSFiddle. (NB: try expanding the output window to show the problem properly)
<div class="PageView">
<nav class="navbar navbar-default">
<div class="container-fluid" id="logoStripe">
<!-- Brand and toggle get grouped for better mobile display -->
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="defaultNavbar1">
<ul class="nav navbar-nav links">
<li>About<span class="sr-only">(current)</span>
</li>
<li>Pre-Order
</li>
<img src="Images/Logo.png" alt="Logo" style="width:auto; height:75px; padding-top:5px; padding-bottom:5px;">
<li>News
</li>
<li>Contact Us
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>
<div class="container-fluid">
<div class="PageView">
<div class="row">
<div class="col-md-12">.col-md-1</div>
</div>
<div class="row">
<div class="col-md-6">Button 1 (align Right)</div>
<div class="col-md-6">Button 2 (align Left)</div>
</div>
</div>
</div>
and the CSS:
.links {
width: 100%;
display: flex;
justify-content: space-between;
font-size: 28px;
color: #FFFFFF;
}
#logoStripe {
background-color: #54534a;
}
.PageView {
height: calc(100% - 75px);
}
Can anyone see what I have done wrong? Any ideas would be much appreciated.
Percentage heights calculate from their parents height so you have to start from the most parent element and cascade it down to the element you want with the modified height. You also have two divs with .PageView that cannot use the same CSS to work properly; I'm not sure if this was done on purpose.
Also, if you are using calc, you will need to adjust the pixel amount for each of Bootstrap's breakpoints.
html, body, .PageView {
height:100%;
}
.links {
width: 100%;
display: flex;
justify-content: space-between;
font-size: 28px;
color: #FFFFFF;
}
#logoStripe {
background-color: #54534a;
}
.adjustedHeight {
height: calc(100% - 77px);
background-color:red; /* For emphasis */
}
.PageView .navbar {
margin:0;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/>
<div class="PageView">
<nav class="navbar navbar-default">
<div class="container-fluid" id="logoStripe">
<!-- Brand and toggle get grouped for better mobile display -->
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="defaultNavbar1">
<ul class="nav navbar-nav links">
<li>About<span class="sr-only">(current)</span>
</li>
<li>Pre-Order
</li>
<img src="Images/Logo.png" alt="Logo" style="width:auto; height:75px; padding-top:5px; padding-bottom:5px;">
<li>News
</li>
<li>Contact Us
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>
<div class="container-fluid adjustedHeight">
<div class="PageView2">
<div class="row">
<div class="col-md-12">.col-md-1</div>
</div>
<div class="row">
<div class="col-md-6">Button 1 (align Right)</div>
<div class="col-md-6">Button 2 (align Left)</div>
</div>
</div>
</div>

Vertical alignment does not work in Bootstrap

I'm trying to vertically center the menu links of my header, but does not work. I'm using Bootstrap.
HTML
<div class="container-fluid">
<div class="row">
<div class="col-xs-12 header">
<div class="row">
<div class="col-xs-1"></div>
<div class="col-xs-2" style="font-size: 40px;">
<p>Capelli</p>
</div>
<div class="col-xs-3"></div>
<div class="col-xs-6">
<ul class="list-group list-inline">
<li>Vestidos</li>
<li>Meus Pedidos</li>
<li></li>
<li></li>
<li>Login</li>
<li>Cadastro</li>
<li></li>
<li></li>
<li>Carrinho</li>
</ul>
</div>
<div class="col-xs-1"></div>
</div>
</div>
</div>
</div>
CSS
body {
background-color: #CFCFCF;
}
.header {
min-height: 3.7em;
color: #FFFFFF;
background-color: #002A43;
font-family: Arial, sans-serif;
font-size: 20px;
}
.vertical {
float: none;
display: inline-block;
vertical-align: middle;
}
When a run the code, nothing happens.
I've tried many things, like use the class directly in row or in col-, but nothing work. I also trie diferent methods to align vertically, but did not work.
P.S.: Sorry for my bad english.
You want to create a nav bar menu?
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#">Capelli</a>
</div>
<div>
<ul class="nav navbar-nav push-right">
<li class="active">Vestidos</li>
<li> etc</li>
<li>etc</li>
<li>etc</li>
</ul>
</div>
</div>
</nav>
in css you shoud define the font-size of X pixels, because you are using relative font-size.
its 3.7em of 10px or 20px. depending the browser the value can change.
html{ font-size: 16px;}
.header{font-size: 1.25em; // 20/16 = 1.25 and you have sure the font size is relative to 16 because you have define html font size to 16px;.

space at the bottom of webpage using bootstrap

I'm currently making a website using bootstrap, but at the end of the homepage's background image there is a piece of white space about 50px in length.
Is it possible to get rid of this strip of white space? I have provided my html and css code for the site. Help would be much appreciated.
HTML
<!-- html-->
<div id="title-page">
<div class="container">
<div id="nav" class="navbar navbar-inverse navbar-static-top">
<div class="container">
<button class="navbar-toggle" data-toggle="collapse" data-target=".navHeaderCollapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div class="collapse navbar-collapse navHeaderCollapse">
<ul class="nav navbar-nav navbar-right">
<li>Home</li>
<li>Portfolio</li>
<li>About</li>
<li>Contact</li>
</ul>
</div>
</div>
</div>
<div id="pic-headings">
<h1 class=" text-center" ></h1><>
<br>
<h2 class=" text-center"></h2>
</div>
</div>
</div>
CSS
<!--css-->
#nav{
margin-bottom: 0px;
background-color: transparent;
border: none;
padding-right: 20px;
}
.navbar-brand{
color: #fff;
}
#title-page{
background-size: 100%;
background-size: cover;
background-image: url(stephen1.jpg);
color: #fff;
height: 830px;
margin-bottom: 0px;
}
#pic-headings{
padding-top: 200px;
text-align: center;
}
h1{
font-family: eb-garamond, sans-serif;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
h2{
font-family: eb-garamond, sans-serif;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
On line 24 you have some stray characters <> which can't be helping your situation. And you may consider restructuring your code without the nested container classes and overall just not nesting your div's so deeply. In the process of doing that you will most certainly identify the problem.
Please post link or jsfiddle or more code, and which version of Bootstrap your trying to use to get more help.
this may or may not help get you started
<div id="header">
<div class="container clearfix">
<ul id="nav">
<li></li>
</ul>
</div>
</div>
<div class="container">
<div class="row-fluid">
<div class="span12">
something
</div>
</div>
</div>