changing the width of collapsing navbar - html

I've search and searched but not of the answers are having the desired outcome for some reason.
At the moment my navbar is collapsing at 768px, however I want it to collapse at 1200px instead, I've changed the #media in the CSS files accordingly to reflect this however it just doesn't seem to be taking any effect, what on earth am I doing wrong?
I've tried following the instructions like explained here: Change bootstrap navbar collapse breakpoint without using LESS
but still nothing.
My site is http://www.yourtechgeek.co.uk/
Hope someone can help as I'm really scratching my head now.
TIA

Looking at your site, it is defined for 768 pixels. Change into the following in file bootstrap.min.css or your own css file.
#media (min-width: 1200px)
.container {
width: 750px;
}

to change the navbar break point , for example for the mobile hamburger to appear at 1200px , see this example snippet below
or see fiddle > fiddle
#media (max-width: 1200px) {
.navbar-header {
float: none;
}
.navbar-left,.navbar-right {
float: none !important;
}
.navbar-toggle {
display: block;
}
.navbar-collapse {
border-top: 1px solid transparent;
box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}
.navbar-fixed-top {
top: 0;
border-width: 0 0 1px;
}
.navbar-collapse.collapse {
display: none!important;
}
.navbar-nav {
float: none!important;
margin-top: 7.5px;
}
.navbar-nav>li {
float: none;
}
.navbar-nav>li>a {
padding-top: 10px;
padding-bottom: 10px;
}
.collapse.in{
display:block !important;
}
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="navbar navbar-default">
<div class="navbar-header">
<a class="navbar-brand" href="#">Bootstrap 3</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="dropdown active">
Getting started <b class="caret"></b>
<ul class="dropdown-menu">
<li>Download Bootstrap</li>
<li class="divider"></li>
<li class="dropdown-header">Examples</li>
<li>Basic template</li>
<li>Starter template</li>
<li>Grids</li>
<li>Jumbotron</li>
<li>Navbar</li>
<li>Sign-in page</li>
<li>Sticky footer</li>
<li>Offcanvas</li>
<li>Carousel</li>
<li>Theme</li>
<li class="divider"></li>
<li class="dropdown-header">Compatibility</li>
<li>Migrating from 2.x to 3.0</li>
<li>Browser support</li>
<li>Third party support</li>
</ul>
</li>
<li>CSS</li>
<li>Components</li>
<li>JavaScript</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="active">Customize</li>
</ul>
</div>
</div>
<div class="jumbotron">
<h1>Twitter Bootstrap 3.0</h1>
<p class="lead">Starter template with CSS and JS included.</p>
<p><a class="btn btn-lg btn-primary" href="#fork">Fork this fiddle</a></p>
</div>
</div>

Related

How to apply Media Queries to Cards with Images

been trying to media query my cards + image, for a while now without success, if anyone can guide me through I'll appreciate it a lot thanks.
Testing it on my phone samsung s9+ vertically.
https://codepen.io/picklemyrickle/pen/XWjzyvb
#media (max-width: 600px) {
#prices {
width: 100%;
}
.listdrop {
width: 100%;
max-width: 100%;
}
.casual {
width: 100%;
}
}
#media (max-width: 600px) {
img {
max-width: 100%;
height: auto;
}
}
#prices {
display: flex;
justify-content: center;
align-items: center;
padding: 100px;
margin: 10px;
}
.listdrop {
margin: 0;
padding: 0;
-webkit-transition: 0.3s;
transition: 0.3s;
border: 1px solid;
list-style-type: none;
width: 10vw;
}
<img src="https://lh3.googleusercontent.com/JH3M2ZropJUZvOoL6IgHOrnZUz3cIEw5taJuPA2N_wyEHmr2hSBOOZHjGX05Q9wJ7DBXaQ8ABvG2rInPk7seHBVf8voG5ePyFXWY-7ciIcrpw_v7w23j6HV856fsSTKuwMpYDg1YDQ=w2400" alt="Gym logo" id="header-img">
<section id="prices">
<!-- <div class="beginner"> -->
<ul class="listdrop">
<li class="card-head">Beginner</li>
<li>Get Big</li>
<li>Get Strong</li>
<li>Feel good</li>
<li class="pay">100$</li>
<li type="button" class="butn" a href="#">Buy</a>
</button>
</li>
</ul>
<!-- </div> -->
<div class="casual">
<ul class="listdrop">
<li class="card-head">Casual</li>
<li>Get Big</li>
<li>Get Strong</li>
<li>Feel good</li>
<li class="pay">200$</li>
<li type="button" class="butn" a href="#">Buy</a>
</button>
</li>
</ul>
</div>
<!-- <div class="intermidate"> -->
<ul class="listdrop">
<li class="card-head">Intermidate</li>
<li>Get Big</li>
<li>Get Strong</li>
<li>Feel good</li>
<li class="pay">300$</li>
<li class="butn" type="button" a href="#">Buy</a>
</button>
</li>
</ul>
<!-- </div> -->
</section>
I tried changing the html, played with the CSS, without success on my own. other elements seem wide enough and works fine besides the card, I tried adding a div element as well after the section but it seems to screw my cards. With IMG I seem to be more lost, horizontally I can see the icon just much smaller, but vertically nothing, I guess because the screen isn't as wide vertically as horizontally but I'm not sure what is the solution for that.

Bootstrap navbar not collapsing to pills at the right point

I have a navbar with a couple of links on the left side and social media buttons on the right. The problem is that when i shrink the window, the links and buttons do not collapse into pills soon enough. Instead, the social media buttons from the right side go under the links on the left side. And then when the window is too narrow to fit the links, the pills appear.
How can I edit this so the navbar collapses at the right position?
Any help is much appreciated:)
Here is my code:
<nav class="navbar navbar-default navbar-fixed-top">
<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="#">WebsiteName</a>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li class="active">Link1</li>
<li>Link2</li>
<li>Link3</li>
<li>Link4</li>
</ul>
<ul class="nav navbar-nav navbar-right nav-pills social-icons icon-circle icon-rotate">
<li><i class="fa fa-facebook"></i></li>
<li><i class="fa fa-instagram"></i></li>
<li><i class="fa fa-twitter"></i></li>
</ul>
</div>
</div>
</nav>
Where you see 1000px, add your own width you want.
#media (max-width: 1000px) {
.navbar-header {
float: none;
}
.navbar-left,.navbar-right {
float: none !important;
}
.navbar-toggle {
display: block;
}
.navbar-collapse {
border-top: 1px solid transparent;
box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}
.navbar-fixed-top {
top: 0;
border-width: 0 0 1px;
}
.navbar-collapse.collapse {
display: none!important;
}
.navbar-nav {
float: none!important;
margin-top: 7.5px;
}
.navbar-nav>li {
float: none;
}
.navbar-nav>li>a {
padding-top: 10px;
padding-bottom: 10px;
}
.collapse.in{
display:block !important;
}
}
you can create a class that , according to from the screen size , determines the width or more of the navbar .
#media ( max-width : 767px ) {
.widthNavbar {
width : 700px;
}
}
or you can put the class is activated between two values ​​:
#media ( min-width : 768px ) and ( max-width : 979px ) {
.widthNavbar {
width : 700px;
}
}

Bootstrap nav bar collapsing

i'm working on upgrading a website so it becomes responsive. I'm using twitter bootstrap. I already tried a couple of different nav bar templates that i found online and i always have the same problem. As you can see in the images in some resolutions the nav bar isn't collapsing the way it should.
The problem:
The navbar html code:
<!-- Fixed navbar -->
<nav class="navbar navbar-default navbar-fixed">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<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="index.htm">Index</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>casa do meio
</li>
<li>casa brava
</li>
<li>casa velha
</li>
<li>pool
</li>
<li>prijzen
</li>
<li>over ons
</li>
<li>activiteiten
</li>
<li>gastenboek
</li>
<li>kaartje
</li>
<li>contact
</li>
<li>linken
</li>
</ul>
</div><!--/.nav-collapse -->
</div>
</nav>
I also have this in my css:
#media (min-width: 768px) and (max-width: 991px) {
.navbar-collapse.collapse {
display: none !important;
}
.navbar-collapse.collapse.in {
display: block !important;
}
.navbar-header .collapse, .navbar-toggle {
display:block !important;
}
.navbar-header {
float:none;
}
}
Any help would be appreciated!
This is the complete CSS (*taking into account your site structure) if you want to change your breakpoint for the navigation on smaller viewports.
You should also consider moving some of your links into dropdown lists which would allow you to avoid all of this.
#media (max-width: 1199px) {
#custom-bootstrap-menu .navbar-collapse.collapse {
display: none !important;
}
#custom-bootstrap-menu .navbar-collapse.collapse.in {
display: block !important;
}
#custom-bootstrap-menu .navbar-toggle {
display: block !important;
}
#custom-bootstrap-menu .navbar-collapse {
text-align: center;
display: block !important;
}
#custom-bootstrap-menu .navbar-header {
float: none;
display: block !important;
}
#custom-bootstrap-menu .navbar-nav {
display: inline-block;
float: none;
vertical-align: top;
}
#custom-bootstrap-menu .navbar-nav > li {
float: none;
}
#custom-bootstrap-menu .navbar-nav> li > a {
padding-top: 10px;
padding-bottom: 10px;
}
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<p>
<img src="http://www.huisjeinportugal.nl/images/top.jpg" class="img-responsive">
</p>
<div id="custom-bootstrap-menu" class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header"><a class="navbar-brand" href="index.htm">Index</a>
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-menubuilder"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse navbar-menubuilder">
<ul class="nav navbar-nav">
<li>casa do meio
</li>
<li>casa brava
</li>
<li>casa velha
</li>
<li>pool
</li>
<li>prijzen
</li>
<li>over ons
</li>
<li>activiteiten
</li>
<li>gastenboek
</li>
<li>kaartje
</li>
<li>contact
</li>
<li>linken
</li>
</ul>
</div>
</div>
</div>
It looks like your navigation is fairly wide, so what you could do is simply change when the bootstrap nav collapses. Looking at your code, 1000px seems to be a good breaking point for the collapse to happen, but you can play around with that.
One solution would be to go and add a new media query that will overwite that of Bootstraps. This solution would be fine if you don't want to edit your bootstrap code directly:
#media (max-width: 1000px) {
.navbar-header {
float: none;
}
.navbar-toggle {
display: block;
}
.navbar-collapse {
border-top: 1px solid transparent;
box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}
.navbar-collapse.collapse {
display: none!important;
}
.navbar-nav {
float: none!important;
margin: 7.5px -15px;
}
.navbar-nav>li {
float: none;
}
.navbar-nav>li>a {
padding-top: 10px;
padding-bottom: 10px;
}
}
Another, easier option, if you are using LESS is to change the variables that trigger the breakpoint. You could instead use something along these lines:
// Point at which the navbar becomes uncollapsed.
#grid-float-breakpoint: 1000px;

CSS, Horizontal dropdown with tier 3 meganav

I'm trying to make a nav, where tier 2 is a list inline (done with css, not with list-inline class) and the tier 3 should be a meganav as shown, but:
with the following CSS:
.dropdown-submenu-meganav .dropdown-menu{
position: relative;
width: 800px;
}
.inline {
width: 300px !important;
list-style-type: none !important;
margin: 0 !important;
padding: 0 !important;
}
.inline>li {
display: inline !important;
width: 60px !important;
}
.inline>li>a {
display: block;
width: 60px;
}
and a snippet of the nav (added open class for debugging)
<li class="dropdown open">
Tier1
<ul class="dropdown-menu inline">
<li class="dropdown-submenu dropdown-submenu-meganav open">
<a tabindex="-1" href="#">Tier2 item1</a>
<ul class="dropdown-menu">
<div class="container-fluid">
<div class="row">
<div class="col-md-3 mega-nav-section-wr">
<div class="mega-nav-section">
<h3 class="mega-nav-section-title">Header</h3>
<ul class="mega-nav-ul">
<li>link</li>
<li>link</li>
<li>link</li>
</ul>
it shows up as follows:
So unwillingly, it expands the parent element, and if i hover it, it turns into:
So the tier 2 should show as inline, but doesnt.
Any help or pointing in the right direction will be much appreciated.

Navbar wraps down to second line despite having enough space on the right

I am using Bootstrap 3.3.0 and my navbar wraps down to second line despite having enough space on the right to fit another item. If I reduce the font size, it just shrinks in size but still remains wrapped. How do I keep it in one line?
Image : http://i59.tinypic.com/16knkvo.png
Here is the code:
.navbar{
height: 25%;
background-color: #FCE218;
border-radius: 0px;
}
.navbar-header,.nav,.navbar-nav,.navbar-brand{
height: 100%;
}
.nav-margin{
padding-top: 2%;
}
.nav-link-font{
color: #FF4325;
}
.nav-link-active-font{
font-weight: bold;
color: #18740B;
}
.nav-link-font,.nav-link-active-font{
font-family: 'Indie Flower', cursive;
font-size: 150%;
text-align: center;
border: solid;
border-color: #0B2D13;
border-width: 1px;
width: 100%;
}
.nav-item{
margin-right: 2%;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
<nav class="container-fluid navbar" role="navigation">
<div class="navbar-header">
<a class="navbar-brand" href="#">
<img class="img-responsive" src="images/HeaderImg.png" alt="Aamantran - Alphonso Mangoes" />
</a>
</div>
<div class="nav-margin">
<ul class="nav navbar-nav">
<li class="active nav-item"><a class="nav-link-active-font" href="#">Home</a></li>
<li class="nav-item"><a class="nav-link-font" href="#">Why Aamantran?</a></li>
<li class="nav-item"><a class="nav-link-font" href="#">Quality Assurance</a></li>
<li class="nav-item"><a class="nav-link-font" href="#">Recipes</a></li>
<li class="nav-item"><a class="nav-link-font" href="#">Contact Us</a></li>
</ul>
</div>
</nav>
The problem is the margin-right you are applying to the nav-item class. You are using a percentage rather than an absolute value. Change it to this and it will stop wrapping:
.nav-item{
margin-right: 10px;
}
Someone here had posted an answer asking me to set navbar-nav width to 100%. Well, somewhere around 60% worked for me! He deleted that answer posted for some reason I cant guess. But thank you all for your help! :)