Bootstrap columns are overlapping when the browser window is resized - css

I'm new to Bootstrap and having some styling issues with a project I'm working on. When my window is resized and made smaller, my columns start to overlap. How do I fix this and make it so the text (in this case the messages) are always aligned to the left side of the column?
What am I doing wrong here?
I've made an example page here:
https://www.bootply.com/JxB5m6qw8Z
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<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="/">Chat</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav"></ul>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
User2 <span class="caret"></span>
<ul class="dropdown-menu">
<li>Settings</li>
<li role="separator" class="divider"></li>
<li><a rel="nofollow" data-method="delete" href="/users/sign_out">Logout</a></li>
</ul>
</li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
<div class="fluid-container" style="margin-top: 70px">
<div class="row">
<div class="col-sm-2 sidebar-main">
<div class="sidebar-items">
<div class="sidebar-channels">
<h4>Channels</h4>
<ul>
<div class="sidebar-listitem">
<li># <a data-behavior="chatroom-link" data-chatroom-id="25" href="/chatrooms/25">General</a></li>
</div>
</ul>
</div>
<div class="sidebar-users">
<h4>Current Users</h4>
<ul>
<div class="sidebar-listitem">
<li><a data-behavior="chatroom-link" data-chatroom-id="28" href="/direct_messages/6">User1</a></li>
</div>
<div class="sidebar-listitem">
<li><a data-behavior="chatroom-link" href="/direct_messages/7">User3</a></li>
</div>
</ul>
</div>
</div>
</div>
<div class="col-sm-10 col-sm-offset-2 body-main">
<div class="room-name">
<h2>General</h2>
</div>
<div class="message-window">
<div data-behavior='messages' data-chatroom-id='25' class="messages">
<div><strong>User2: </strong> sd</div>
<div><strong>User2: </strong> csd</div>
<div><strong>User2: </strong> c</div>
<div><strong>User2: </strong> sdc</div>
<div><strong>User2: </strong> sd</div>
<div><strong>User2: </strong> cs</div>
</div>
<div class="message-form">
<form class="new_message" id="new_message" action="/chatrooms/25/messages" accept-charset="UTF-8" method="post"><input name="utf8" type="hidden" value="✓" /><input type="hidden" name="authenticity_token" value="4NCGg4CJSb0jWbL+Xsx+FuNYTIUM/LD/el5IIuF3cRTHLXy9LzFAIUR+T5C8ATiJKeYdrbceMAeTc79E7OgLGg==" />
<textarea rows="1" class="form-control" autofocus="autofocus" name="message[body]" id="message_body">
</textarea>
</form>
</div>
</div>
</div>
</div>
</div>

I am pretty sure your problem is that using col-sm isn't working because your screen is smaller than what that column size is meant to accommodate. Try using col-xs instead.
Not to mention, you used fluid-container instead of container-fluid at one point.

Related

Bootstrap navbar-fixed-top overlapping carousel slider

So, want put a navbar-fixed-top in my nav. The proposal is that my nav follow when scrolling page. But the difficulty is that my nav is overlapping the section right below in this case, my carousel slide.
here de jsfiddle
https://jsfiddle.net/fhvo7anz/
<header class="container-fluid">
<div class="container bghead navbar-fixed-top ">
<div class="row">
<div class="col-md-4">
<img class="img-responsive" src="images/logo.png"><br>
</div>
<div class="col-md-8">
<nav class="navbar navbar-default bgnav">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li>Home<span class="sr-only"></span></li>
<li class="dropdown">
Institucional <span class="caret"></span>
<ul class="dropdown-menu">
<li>Institucional</li>
<li>Missão, Visão e Valores</li>
<li>Organograma</li>
<!--<li role="separator" class="divider"></li>-->
</ul>
</li>
<li>Atividades</li>
<li>Link</li>
<li>Contato</li>
</ul>
<form class="navbar-form navbar-right" role="search">
<div class="form-group">
<input type="text" class="form-control" placeholder="Procurar">
</div>
<button type="submit" class="btn btn-default">Ir</button>
</form>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
</div>
</div>
</div>
</header>
Add this to your CSS:
#carousel-example-generic {
margin-top:150px;
}

Can search bar fixed in navigation bar -bootstrap in mobile view

I am a web developer and doing a responsive website using bootstrap and wordpress. I have a search bar in the main navigation bar. In the mobile view there comes a toggle button for menu and the search bar will be shown in the dropdown.
My problem is, i would like the search bar to be shown in the main navigation bar itself, not in dropdown, in mobile view. Is there any solution for this ?
Here is the website url : http://galtechprojects.com/wp_talichka/
Thanks in advance.
Following is my code of navigation part in header.php
<div class="top-bar-inner-left">
<!-- Navigation -->
<nav class="navbar " role="navigation" style="background-color:#000;">
<div class="container" style="padding-left:0px;padding-right:0px;">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" style="background-color:#000;">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1" style="padding:left-0px;padding-right:0px;">
<!--START COL MD 9-->
<div class="col-md-9" style="overflow:hidden;">
<ul class="nav navbar-nav">
<li class="font">HELLO </li>
<li class="font">FASHION</li>
<li class="font">FOOD</li>
<li class="font">BEAUTY </li>
<li class="font">ART</li>
<li class="font"> PRESS</li>
<li class="font">ABOUT US</li>
<li class="font">CONTACT US</li>
</ul>
</div>
<!--START COL MD 3-->
<div class="col-md-3" style="padding-top:1%; overflow:hidden;padding-right:0px;">
<div class="bottom_search">
<span style="float:left;">
<form method="get" id="searchform" action="">
<div style="float: left;width: 100%;margin-top: 2%;"><input type="text" size="18" placeholder="SEARCH" value="" name="s" id="s" class="input" style="float: left" onfocus="clearvalu()" />
<input type="submit" id="searchsubmit" value="" class="btn1" />
</div>
</form>
</span>
</div>
</div>
<!--END COL MD 3-->
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>
</div>
Show us some code, but you could try to add it to the navbar-header.
So, I have to move your form to go inside the navbar-header. I modify a little your search bar, to add the default bootstrap search glyphicon.
<div class="top-bar-inner-left">
<!-- Navigation -->
<nav class="navbar" role="navigation" style="background-color:#000;">
<div class="container" style="padding-left:0px;padding-right:0px;">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"
style="background-color:#000;"> <span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span
class="icon-bar"></span> <span class="icon-bar"></span>
</button>
<form method="get" id="searchform" action="" class="navbar">
<div style="float: left;width: 100%;margin-top: 8%;" class="input-group">
<input type="text" size="18" placeholder="SEARCH" value="" name="s" id="s"
class="input" style="float: left" onfocus="clearvalu()">
<div class="inner-addon right-addon">
<i class="glyphicon glyphicon-search"></i>
</div>
</div>
</form>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"
style="padding:left-0px;padding-right:0px;">
<!--START COL MD 9-->
<div class="col-md-9" style="overflow:hidden;">
<ul class="nav navbar-nav">
<li class="font">HELLO
</li>
<li class="font">FASHION
</li>
<li class="font">FOOD
</li>
<li class="font">BEAUTY
</li>
<li class="font">ART
</li>
<li class="font"> PRESS
</li>
<li class="font">ABOUT US
</li>
<li class="font">CONTACT US
</li>
</ul>
</div>
<!--START COL MD 3-->
<div class="col-md-3" style="padding-top:1%; overflow:hidden;padding-right:0px;">
<div class="bottom_search"> <span style="float:left;" class="">
</span>
</div>
</div>
<!--END COL MD 3-->
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>
</div>
Hope this helps you.
Here is a DEMO on bootply: DEMO

How to adjust nav tabs by default to get adjusted to mobile device resolution?

I have a nav tab developed using twitter bootstrap 3. but, its not getting adjusted to mobile resolution by default. How do I adjust it using the class?
Code:
<div class="row clearfix">
<div class="col-md-12 column">
<div class="tabbable" id="tabs-85910">
<ul class="nav nav-tabs">
<li class="active">
Home
</li>
<li>
Personal Details
</li>
<li>
Product Details
</li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="panel-421853">
<p>
I'm in Section 1.
</p>
</div>
<div class="tab-pane" id="panel-277629">
<p>
Howdy, I'm in Section 2.
</p>
</div>
<div class="tab-pane" id="panel-277620">
<p>
Howdy, I'm in Section 3.
</p>
</div>
</div>
</div>
</div>
</div>
Screen shot of problem attached.
Add this html :-
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".tabbable">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<ul class="nav nav-tabs" class="collapse">

Permanent search in header (w/ Bootstrap)

New to Bootstrap, but I want to have a header that always has a search bar on it regardless of the screen size. The nav bar will always have the search box and button, and then depending on the screen size have a set of links/buttons that will collapse on smaller devices. The search and the links should be on the same row.
Right now there seem to be issues with search box growing/shrinking and the links getting moved to a second row.
<div class="navbar navbar-default 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>
<a class="navbar-brand" href="#">My Project</a>
<div class="col-xs-6 col-sm-4 pull-left">
<form class="navbar-form" role="search">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search" name="srch-term" id="srch-term">
<div class="input-group-btn">
<button class="btn btn-default" type="submit"><span class="glyphicon glyphicon-search"></span></button>
</div>
</div>
</form>
</div>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active">Home</li>
<li>Shows</li>
<li>States</li>
<li>Road Trip</li>
<li>Login</li>
</ul>
</div><!--/.navbar-collapse -->
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active">Home</li>
<li>Shows</li>
<li>States</li>
<li>Road Trip</li>
<li>Login</li>
</ul>
</div><!--/.navbar-collapse -->
This also bar disappears on a smaller resolution, is that intentional?

Twitter bootstrap fluid layout designing trouble

I am designing a fluid layout with twitter bootstrap but unfortunately there is some mistake in how i am approaching it.
Please advise where am i doing wrong. I have created a navbar div which contains navbar-inner and within that i have container. Within a container a row.
In a row i have 3 elements the project-name , the navigation bar and the login section.
On shrinking the page the project name stays in correct position, the navbar is hidden to show up only on click and the third the login section gets dislocated.
I can't understand why it is getting dis located.
I have uploaded the code on ---> http://jsfiddle.net/GgzgB/2/
but due to missing images the background is not shown.
PS: this is my first css attempt
<body>
<div class="navbar navbar-fixed-top">
<div id='cssmenu' class="navbar-inner">
<!--<div class="navbar-custom">-->
<div class="container">
<div class="row">
<div class="span2">
<!--<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>-->
<a class="brand" href="#">Project name</a>
</div><!--end of first col -span2-->
<div class="span7">
<div class="nav-collapse collapse">
<ul class="nav">
<li class='active '><a href='#'><span>Home</span></a></li>
<li><a href='#'><span>Products</span></a></li>
<li><a href='#'><span>Company</span></a></li>
<li><a href='#'><span>Contact</span></a></li>
</ul>
</div><!--end of nav-collapse collapse-->
</div><!--end of second col - span5-->
<div class="span3">
<div class="login">
<form class="form-signin">
<div class="row">
<div class="span1">
<div class="row">
<input type="text" class="input-header-small pull-left" placeholder="Username">
</div>
<div class="row">
<input type="password" class="input-header-small pull-left" placeholder="Password">
</div>
</div>
<div class="span1">
<div class="row">
<button type="submit" class="btn btn-success btn-medium pull-right">Sign in</button></div>
</div>
</div><!--end of inner 1st row-->
</form>
</div><!--end of login-->
</div><!-- end of span3-->
</div><!-- end of row -->
</div><!-- end of container -->
</div><!-- end of inner -->
</div><!-- end of navbar navbar-fixed-top -->
</body>
First off, if you are trying to create a fluid layout, you'd use row-fluid as opposed to just row.
Additionally, you're putting the login form in the same row as the project-name and navbar.
I'm not going to perfect this for you, but this gets you much closer by using row-fluid, and creating a new row after the navigation:
<body>
<div class="navbar navbar-fixed-top">
<div id='cssmenu' class="navbar-inner">
<div class="container">
<div class="row-fluid">
<div class="span2">
<a class="brand" href="#">Project name</a>
</div>
<div class="span7">
<div class="nav-collapse collapse">
<ul class="nav">
<li class='active '><a href='#'><span>Home</span></a></li>
<li><a href='#'><span>Products</span></a></li>
<li><a href='#'><span>Company</span></a></li>
<li><a href='#'><span>Contact</span></a></li>
</ul>
</div><!--end of nav-collapse collapse-->
</div><!--end of second col - span5-->
</div>
<div class="row-fluid">
<div class="span12">
<div class="login">
<form class="form-signin">
<div class="row-fluid">
<div class="span12">
<div class="row-fluid">
<input type="text" class="input-header-small pull-left" placeholder="Username">
</div>
<div class="row-fluid">
<input type="password" class="input-header-small pull-left" placeholder="Password">
</div>
</div>
<div class="row-fluid">
<div class="span12">
<div class="row-fluid">
<button type="submit" class="btn btn-success btn-medium pull-right">Sign in</button></div>
</div>
</div>
</div>
</form>
</div><!--end of login-->
</div><!-- end of span3-->
</div><!-- end of row -->
</div><!-- end of container -->
</div><!-- end of inner -->
</div><!-- end of navbar navbar-fixed-top -->
Often with CSS less is more, so I think you could start off with simplifying your code a bit by removing all the row/span definitions in the navbar, they aren't really necessary. Next, the Bootstrap documentation is quite good, so its always worth looking through them in detail to see if what you want has already been defined there.
From the documentation: "Align nav links, search form, or text, use the .pull-left or .pull-right utility classes. Both classes will add a CSS float in the specified direction." Also, we can use the "navbar-form" class to layout the login form, rather than the grid classes. So lets pare the code down a bit, and then you can perhaps get closer to what you are after.
<body>
<div class="navbar navbar-fixed-top">
<div id='cssmenu' 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>
<a class="brand" href="#">Project name</a>
<div class="nav-collapse collapse">
<ul class="nav">
<li class='active '><a href='#'><span>Home</span></a></li>
<li><a href='#'><span>Products</span></a></li>
<li><a href='#'><span>Company</span></a></li>
<li><a href='#'><span>Contact</span></a></li>
</ul>
</div><!--end of nav-collapse collapse-->
<div class="login pull-right">
<form class="form-signin navbar-form">
<input type="text" class="input-header-small pull-left" placeholder="Username">
<input type="password" class="input-header-small pull-left" placeholder="Password">
<button type="submit" class="btn btn-success btn-medium pull-right">Sign in</button></div>
</form>
</div><!--end of login-->
</div><!-- end of container -->
</div><!-- end of inner -->
</div><!-- end of navbar navbar-fixed-top -->
</body>
This may not be your final solution, but I think it would be a good starting point.

Resources