Basically I want my drop down boxes to be horizontally aligned in the center of the <div>. Currently they are in a column and inside a <div> which has displayed them vertically, by default and has pushed the content to the left of the <div>.
I'm using the latest version of bootstrap and only have CSS to pad the header and to set it as transparent!
<div class=" navbar transparent navbar-default navbar-fixed-top" role="navigation"> <!--HEADER-->
<div class="container-fluid header"> <!--CONTAINER- Needs to be inset slightly-->
<div class="row">
<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>
</div>
<!--First NavBar Colum - Logo is Located Here-->
<div class=" navbar-collapse collapse">
<div class="col-sm-4 ">
</div>
<!--Second NavBar Colum - Centered Horizontal Navigation Links are Located Here-->
<div class="col-sm-4 ">
<ul class="nav navbar-nav navbar-left">
<ul class="dropdown">
<i class="fa fa-circle-o"></i>
PLAY
<ul class="dropdown-menu">
<li class="divider"></li>
<li>Public Teatimes</li>
<li>Member Teatimes</li>
<li>Course Tour</li>
<li>Rates and Ratings</li>
<li>Outings</li>
</ul>
</ul>
<ul class="dropdown">
<i class="fa fa-circle-o"></i>
CLUB
<ul class="dropdown-menu">
<li class="divider"></li>
<li>Membership</li>
<li>Calender</li>
<li>Lessons and Shop</li>
<li>Bar and Food</li>
</ul>
</ul>
<ul>
<i class="fa fa-circle-o"></i>
CONTACT
</ul>
</ul>
</div>
<!--Third NavBar Colum - Social Media Icons are Located Here-->
<div class="col-sm-4">
<i class="fa fa-facebook-square fa-3x"></i>
<i class="fa fa-twitter-square fa-3x"></i>
<i class="fa fa-instagram fa-3x"></i>
</div>
</div> <!--/ .nav-collapse-->
</div>
</div>
</div>
In .navbar-nav, .navbar-left there is float:left . SO, you have remove that first float:none. Then on parent col-sm-4 you can add .text-center.
Try something like this
.navbar-nav{
width:250px;
margin:0 auto;
float:none;
text-align:center;
}
And remove float from <li> if you use.
#media (min-width: 768px)
.navbar-nav {
text-align: center;}
Related
We have a custom eCommerce website and below is the code for the categories list which is a drop-down menu.
<div id="nav-header" class="nav-header navbar-default">
<div class="container ">
<div class="row">
<nav class="ms-mb-0" role="navigation">
<div class="col-sm-3 col-md-3">
<!--navheader sidebar categories on home page-->
<div class=" hover-dropdown dropdown vertical-megamenu navheader-sidebar-category ">
<div class="ms-br-zero dropdown-toggle btn-primary" type="button"
id="dropdownMenu1" data-toggle="dropdown">
<div id="menu-icon">
{{'SHOP BY CATEGORIES'|msTranslate}}
<i class="fa fa-bars pull-right ms-pt-xs"></i>
</div>
</div>
<ul
class="list-group nav-ul-color dropdown-menu ms-br-zero ms-br-none ms-pt-0 ms-pb-0 ms-mt-0 ms-w-full ms-z-index20 ms-pos-absolute"
role="menu" aria-labelledby="dropdownMenu1" aria-expanded="true"
data-ng-init="show={}">
<li class="list-group-item ms-br-zero level1" role="presentation "
data-ng-repeat="category in navigation.header.links">
<a href="{{category.url}}" class="ms-p-0 ms-ws-normal"
title="{{category.title|msTranslate}}">
{{category.title}}
<span data-ng-if="category.children.length ">
<i class="fa fa-angle-right pull-right">
</i>
</span>
</a>
<ul ng-if="category.children.length" class="list-unstyled level2 vertical"
ng-style="{'column-count':{{getcount(category)}}}">
<div class=" ms-p-xs dropdownMenu-lvl2">
<div class="dropdownMenu-lvl3 ms-pr-xs ms-lh-25 ms-mb-s "
ng-repeat="subcategory in category.children">
<a href="{{subcategory.url}}"
title="{{subcategory.title|msTranslate}}">
{{subcategory.title}}
<i ng-if="subcategory.children.length"
class="fa fa-caret-left">
</i>
</a>
<ul class="list-unstyled level3"
ng-if="subcategory.children.length">
<li ng-repeat="subcategory2 in subcategory.children"
class="subcategory2 ">
<a href="{{subcategory2.url}}"
title="{{subcategory2.title}}"
class="level3-links ">
{{subcategory2.title}}
</a>
</li>
</ul>
</div>
</div>
</ul>
</li>
<li class="list-group-item ms-br-zero level1" role="presentation ">
<a href="/allcategories" class="ms-p-0 ms-ws-normal"
title="{{'SEE ALL CATEGORIES'|msTranslate}}">
{{'SEE ALL CATEGORIES'|msTranslate}}
</a>
</li>
</ul>
</div>
</div>
If the language is English, subcategories show on the right side which is perfect as below:
But if the language is Arabic, subcategories show on the right side which is wrong because it is overflowing from the screen:
For Arabic, the menu should show on the left side of the screen.
I tried the following in the custom CSS but still the menu in Arabic doesn't show on the left side:
body .dropdownMenu1.dropdownMenu-lvl2,
body .dropdownMenu-lvl2.dropdownMenu-lvl3 {left:-250px !important;}
How to correct the code so that the menus in Arabic show on the left side.
I have a navbar that does collapse as it should in mobile view but on the tablet (or ipad pro) there is a break or large padding/gap that breaks the navigation. The testing site is at:
padding or margin bottom occurs in tablet view
I have tried a number of things like adjusting the viewport and adding links to bootstraps transition.js and collapse.js files but that is not working either.
<!--navigation bar-->
<nav class="navbar navbar-default transparent navbar-static-top" role="navigation" id="navbar-main">
<div class="container">
<div class="row">
<div class="col-sm-12">
<div class="row">
<div class="col-lg-12"> <a class="navbar-brand" href="http://patskailua.com/index.php"><img src="http://patskailua.com/images/kailua-beach-properties-llc.png" alt="pats kailua hawaiian Flower" usemap="#Map" class="img-responsive">
</a></div>
</div>
</div>
</div>
</div>
<div class="navbar-header">
<div class="text-center">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navCollapse">
<span class="sr-only">Toggle Navigation</span>
<span class="fa fa-chevron-down"></span> Menu
</button>
<div class="collapse navbar-collapse" id="navCollapse">
<ul class="nav navbar-nav navbar-right">
<li class="active goleft1">vacation rentals</li>
<li>kailua activities</li>
<li class="dropdown">
rentals by size<span class="caret black"></span>
<ul class="dropdown-menu">
<li><a href="http://patskailua.com/wp/three-bedrooms.php" >Three Bedrooms</a></li>
<li>Two Bedrooms</li>
<li>One Bedrooms</li>
<li>Studios</li>
</ul>
</li><li>contact us </li>
<li>about us</li>
<li class="dropdown">
property management and sales<span class="caret black"></span>
<ul class="dropdown-menu">
<li>Property Management</li>
<li>Buying a Property</li>
<li>Selling a Property</li>
<li class="goleft">home</li>
</li>
</ul>
</div>
</nav>
<!--end nav bar-->
If anyone has any ideas on how to fix this, that would be great. Thanks so much. -Beth
You could try changing the class col-lg-12 by col-md-12 or even col-sm-12.
This should make your navbar adapt better smaller resolutions.
I'm doing a site with HTML5 andbootstrap-lessnothing works normally but I needed to change some colors in the navbar menu and I know I can do this throughvariables.less inside this file I navigate to the menus where I copy all the code related to the menu that I want to edit and paste in my .less file but it does not work I do not want to have to use! important to change the menu being that I know I can do this by only variables in the less that comes in the bootsrap this is theless code of the menu
LESS:
#navbar-default-color: #fff;
#navbar-default-bg: #f8f8f8;
#navbar-default-border: darken(#navbar-default-bg, 6.5%);
//* Navbar links*/
#navbar-default-link-color: #fff;
#navbar-default-link-hover-color: #fff;
#navbar-default-link-hover-bg: transparent;
#navbar-default-link-active-color: #fff;
#navbar-default-link-active-bg: darken(#navbar-default-bg, 6.5%);
#navbar-default-link-disabled-color: #fff;
#navbar-default-link-disabled-bg: transparent;
/* Navbar brand label*/
#navbar-default-brand-color: #navbar-default-link-color;
#navbar-default-brand-hover-color: darken(#navbar-default-brand-color, 10%);
#navbar-default-brand-hover-bg: transparent;
/* Navbar toggle*/
#navbar-default-toggle-hover-bg: #fff;
#navbar-default-toggle-icon-bar-bg: #fff;
#navbar-default-toggle-border-color: #fff;
even though I change the values it does not change on my site notice that I left everything white to do a test and my site does not change:
this is my menu:
<nav class="navbar navbar-default">
<div class="container text-center">
<div class="row">
<div class="box-menu">
<div class="col-md-3">
<img src="assets/images/logo-santa-clara-eco.png" class="img-responsive" alt="Santa Clara EcoResort" />
</div>
<div class="col-md-6 hidden-xs hidden-sm">
<ul class="list-unstyled list-inline contact-info">
<li class="list"><i class="fa fa-map-marker" aria-hidden="true"></i>Rod SP 215 Km 197 - Dourado - SP</li>
<li class="list"><i class="fa fa-phone" aria-hidden="true"></i>+55 (16) 3345 4004</li>
<li class="list"><i class="fa fa-envelope" aria-hidden="true"></i>Contato</li>
</ul>
</div>
<div class="col-md-3 hidden-xs hidden-sm">
<img src="assets/images/logo_top.png" class="img-responsive logos-inline" alt="Tripadvisor L'OCITANE ABR" />
</div>
</div>
</div>
<div class="row">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" data-target="#navbarCollapse" data-toggle="collapse" class="navbar-toggle">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<!-- Collection of nav links and other content for toggling -->
<div id="navbarCollapse" class="collapse navbar-collapse">
<ul class="nav navbar-nav list-nav-menu">
<li><i class="fa fa-home" aria-hidden="true"></i></li>
<li>resort</li>
<li><a href="http://santaclaraecoresort.com.br/acomodacoes.php" id="question" >acomodações</a></li>
<li>gastronomia</li>
<li>atividades</li>
<li>SPA </li>
<li>eventos</li>
<li>monitoria</li>
<li>pacotes</li>
<li>programação</li>
<li class="dropdown">
Contato <b class="caret"></b>
<ul class="dropdown-menu">
<li>Localização</li>
</ul>
</li>
</ul>
<ul class="nav navbar-nav navbar-right list-inline social-networks hidden-xs hidden-sm">
<li><i class="fa fa-facebook" aria-hidden="true"></i></li>
<li><i class="fa fa-instagram" aria-hidden="true"></i></li>
<li><i class="fa fa-youtube" aria-hidden="true"></i></li>
<li><i class="fa fa-tripadvisor" aria-hidden="true"></i></li>
</ul>
</div>
</div>
</div>
</nav>
I'm importing everything normal bootstrap``css andjs together with jquery and I'm doing# import right away
<link rel="stylesheet" href="assets/vendor/bootstrap/dist/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script src="assets/vendor/bootstrap/dist/js/bootstrap.min.js"></script>
my app.less file with the import:
#import "../vendor/bootstrap/less/bootstrap.less";
#import "app.css";
image of my variables with the colors I need to change, I copied the variables from the variables.less file and added it to myapp.less I changed the colors they appear on the console but they do not overwrite.
my less file with the color changes (remembering that this is a copy of thevariables.less file)
Hi I am new to CSS and bootstrap. I have a button which will make the navigation sidebar collapsible and all i need is to make the content of the page to float to the left when the navigation sidebar is collapsed and shrink if the navigation sidebar is expanded.
Kindly suggest me a solution :(
below is my sample code
<nav class="navbar navbar-default navbar-fixed-top" role="navigation" >
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header ">
<button type="button" class="navbar-toggle visible-lg" data-toggle="collapse" data-target="#navbar-ex1-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div class="collapse navbar-default navbar-collapse" >
<div class="pull-left" id="navbar-ex1-collapse">
<ul class="nav navbar-default navbar-nav side-nav">
<li class="dropdown">
<i class="fa fa-user"></i> My Profile <b class="caret"></b>
<ul class="dropdown-menu">
<li ><a class="dropdown-color" href="#" style="background:rgba(59, 89, 152, 0.28);" ><i class="fa fa-user"></i> View Profile</a></li>
<li><a class="dropdown-color" href="#" style="background:rgba(59, 89, 152, 0.28);"><i class="fa fa-edit"></i> Edit Profile</a></li>
</ul>
</li>
<li><i class="fa fa-dashboard"></i> Dashboard</li>
<li class="dropdown">
<i class="fa fa-desktop"></i> Deployment <b class="caret"></b>
<ul class="dropdown-menu">
<li><i class="fa fa-edit"></i> Deployment Parameter</li>
<li><i class="fa fa-bar-chart-o"></i> Package Deployment</li>
<li><i class="fa fa-bar-chart-o"></i> Release Deployment</li>
</ul>
</li>
</ul>
</div>
<ul class="nav navbar-nav navbar-right navbar-user">
<li class="dropdown user-dropdown">
<i class="fa fa-user"></i> Username <b class="caret"></b>
<ul class="dropdown-menu">
<li><i class="fa fa-user"></i> View Profile</li>
<li><i class="fa fa-gear"></i> Edit Profile</li>
<li class="divider"></li>
<li><i class="fa fa-power-off"></i> Log Out</li>
</ul>
</li>
</ul>
</div><!-- /.navbar-collapse -->
<div class="auto-adjust" id="page-wrapper">
//table goes here
</div>
below is my css class which i wrote for adjusting the content
CSS:
.auto-adjust{
padding-right: 15px;
padding-left: 15px;
margin-right: auto;
margin-left: auto;
margin:0;
float:left;
}
In Twitters Less code the point that the navbar collapse has been set by #grid-float-breakpoint (set to 768px) by default. Now you can use CSS media queries to only apply your code before that point:
less
#media (max-width: (#grid-float-breakpoint - 1)) {
padding-right: 15px;
padding-left: 15px;
margin: 0 auto;
float:left;
}
CSS output:
#media (max-width: 767px) {
padding-right: 15px;
padding-left: 15px;
margin: 0 auto;
float: left;
}
Notice that you probably better can use Bootstrap's grid, see http://getbootstrap.com/css/#grid-media-queries. The xs grid will be applied when the green width is smaller than 768 pixels too.
Try the following code:
<div class="row">
<div class="col-xs-12 col-sm-6">//table goes here</div>
<div class="col-xs-12 col-sm-6">//other content</div>
</div>
So i just don't get it.
I've looked for some good examples for off canvas in bootstrap 3 but i just don't get it. I have already set up my navigation but dun know how this off canvas works.
When i use a mobile device i want my toggled navigation to slide in from the right to the left over the whole browser screen with an "X" on the upper left corner to close this one again. So it's like : User clicks on the toggled Navigation -> Navigtion slides in from the right to the left over the whole screen -> Navigation is listed there -> click on an menu point and close the navigation with sliding out from left to right.
Anyone got any ideas ???? Really need help
My Navigation looks like this atm :
<header>
<div class="container-header hidden-xs">
<!-- Navigation -->
<div class="first-nav">
<form class="navbar-search">
<input type="text" class="search-query span3" placeholder="search">
</form>
<ul class="social-buttons" id="home">
<li><i class="fa fa-youtube fa-lg"></i></li>
<li><i class="fa fa-twitter fa-lg"></i></li>
<li><i class="fa fa-xing fa-lg"></i></li>
<li><i class="fa fa-rss fa-lg"></i></li>
</ul>
<a class="navbar-lang" href="#" title="English">Eng</a>
</div>
</div>
<div id="nav">
<div class="navbar navbar-default navbar-static" role="navigation">
<div class="second-nav">
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
<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>
<div class="nav-logo">
<img src="images/Logo_nav.png" alt="DnD">
</div>
<div class="navbar-collapse collapse">
<ul class="mainnav nav navbar-nav">
<li>Home</li>
<li>Leistungen</li>
<li>Über uns</li>
<li>Team</li>
<li class="dropdown">
Aktuelles<b class="caret"></b>
<ul class="dropdown-menu">
<li>Alle Artikel</li>
</ul>
</li>
<li>Kunden</li>
<li class="dropdown">
Jobs<b class="caret"></b>
<ul class="dropdown-menu">
<li>Alle Jobs</li>
</ul>
</li>
<li>Kontakt</li>
</ul>
</div>
</div>
</div>
</div>
</header>
Correct me if I am wrong, but something like below should work:
#media screen and (max-width: 767px) {
.row-offcanvas-right.active {
right: calc(100% + 30px); /*30px to get row margin back (-15px + (-15px))*/
}
}