This is a problem , that I have: http://i.stack.imgur.com/i80Yl.jpg .
This is a part of Bootstrap menu.
Some more informations have been added
Header
<link rel="stylesheet" type="text/css" href="view/stylesheet/stylesheet.css" />
<link rel="stylesheet" type="text/css" href="view/stylesheet/bootstrap.css" />
But when i want to overwrite any Bootstrap options i need to use !important. I dont want to change Bootstrap css.
HTML
<div class="container-fluid">
<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="http://localhost/Web/E-Shop/admin/index.php?route=common/home&token=dac2fdfed5ea52154c40dd0ad17dbe92">Obchod</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="dropdown">
Catalog<b class="caret"></b>
<ul class="dropdown-menu">
<li> Categories</li>
<li>Products</li>
<li>Filters</li>
<li>Profiles</li>
<li class="divider"></li>
<li>Attributes</li>
<li>Attribute Groups</li>
<li class="divider"></li>
<li>Options</li>
<li>Manufacturers</li>
<li>Downloads</li>
<li>Reviews</li>
<li>Information</li>
</ul>
</li>
<li class="dropdown">
Extensions<b class="caret"></b>
<ul class="dropdown-menu">
<li>Modules</li>
<li>Shipping</li>
<li>Payments</li>
<li>Order Totals</li>
<li>Product Feeds</li>
</ul>
</li>
<li class="dropdown">
Sales<b class="caret"></b>
<ul class="dropdown-menu">
<li>Orders</li>
<li>Recurring Profiles</li>
<li>Returns</li>
<li class="divider"></li>
<li>Customers</li>
<li>Customer Groups</li>
<li>Banned IP</li>
<li class="divider"></li>
<li>Affiliates</li>
<li>Coupons</li>
<li class="divider"></li>
<li>Gift Vouchers</li>
<li>Voucher Themes</li>
<li class="divider"></li>
<li>Mail</li>
</ul>
</li>
<li class="dropdown">
System<b class="caret"></b>
<ul class="dropdown-menu">
<li>Settings</li>
<li class="divider"></li>
<li>Layouts</li>
<li>Banners</li>
<li class="divider"></li>
<li>Users</li>
<li>User Groups</li>
</ul>
</li>
<li class="dropdown">
Localisation<b class="caret"></b>
<ul class="dropdown-menu">
<li>Languages</li>
<li>Currencies</li>
<li>Stock Statuses</li>
<li>Order Statuses</li>
<li class="divider"></li>
<li>Return Statuses</li>
<li>Return Actions</li>
<li class="divider"></li>
<li>Countries</li>
<li>Zones</li>
<li>Geo Zones</li>
<li class="divider"></li>
<li>Tax Classes</li>
<li>Tax Rates</li>
<li class="divider"></li>
<li>Length Classes</li>
<li>Weight Classes</li>
</ul>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>Error Logs</li>
<li>Backup / Restore</li>
</ul>
</div><!--/.nav-collapse -->
</div>
CSS
.navbar-default {
background-color: #00598e !important;
border-color: none !important;
color: #fff !important;
}
.navbar-default .navbar-nav > li > a {
color: #fff !important;
}
.navbar-default .navbar-brand {
color: #FFF !important;
}
.dropdown .open{
}
.dropdown:hover .dropdown-menu {
display: block;
}
.dropdown:hover {
background-color: #0077c0;
}
.vertical-offset-100{
padding-top:100px;
}
.footer-s{
position:fixed;
left:0px;
bottom:0px;
width:100%;
}
.alert{
margin-top: 30px;
}
.nav .open>a, .nav .open>a:hover, .nav .open>a:focus {
background-color: #00598e;
border-color: #00598e;
}
.dropdown-menu>li>ul>li>a:hover, .dropdown-menu>li>ul>li>a:focus{
text-decoration: none;
color: #262626;
background-color: #F5F5F5;
}
.container{
margin-top: 50px;
}
.btn>a:hover,
.btn>a:focus,
.btn>a {
color: #fff;
text-decoration: none;
}
.scrollbox{
height: 120px;
width: auto;
border: 1px solid #ccc;
overflow: auto;
}
.navbar-default .navbar-nav > .open > a, .navbar-default .navbar-nav > .open > a:hover, .navbar-default .navbar-nav > .open > a:focus {
color: #FFF;
background-color: #0077c0 !important;
}
.navbar-default .navbar-toggle .icon-bar {
background-color: #FFF !important;
}
I suggest you move your override or custom stylesheet below (after) the boostrap CSS file. Then, you shouldn't need to use !important as much or ever. Just remember that you'll need to match or exceed the same specificity in your custom stylesheet to make overrides.
<link rel="stylesheet" type="text/css" href="view/stylesheet/bootstrap.css" />
<link rel="stylesheet" type="text/css" href="view/stylesheet/stylesheet.css" /> <!-- moved below bootstrap.css -->
Related
I've gotten the following code to look as I want it, except I need the last two nav bar items to align far right.
I can make that happen with ul {text-align: right; width: 100%; background-color: #48C2C5;}, but when I do that, it alters the size of my dropdown menus.
I've attached a few pictures along with the code.
I'm doing this in Springshare Libguides.
Nav bar without far right 2 aligned right:
Cut off dropdown menu:
<style>
.s-lib-box {border-color: none; border-width: 0; box-shadow: none; background-color: none;}
.s-lib-box .s-lib-box-title {display: none;}
.s-lib-box .s-lg-box-footer {display: none;}
body {padding-left: 0; padding-right: 0;}
#s-lib-public-main a {color: #17365D;}
#s-lib-public-main a:visited {color: #2293c0;}
/*ABC Header*/
#header-abc {background-color: #ffffff; width: auto; }
#banner-abc {height: 110px; width: 1200px; margin-left: auto; margin-right: auto;}
#logo-abc {float: left; margin-left: 12px; margin-top: 10px;}
#search-cat {margin-top: 15px; padding: 0px 0px; text-align: right;}
#translate {padding: 2px 0px;}
#google_translate_element {width: 160px; margin: 15px 0;}
/*Menu*/
.caret{solid #ffffff;}
#menu-abc .navbar .nav > li > a, .navbar .nav > li > a:first-letter,
.navbar .nav > li.current-menu-item > a,
.navbar .nav > li.current-menu-ancestor > a {
}
#menu-abc .navbar .nav > li > a, .navbar .nav > li > a:first-letter {
color: white;
text-shadow: none;
}
#menu-abc .navbar .nav > li > a:hover, .navbar .nav > li > a:hover:first-letter {
color:#006699;
text-shadow: none;
}
#menu-abc .navbar .nav > li > a:active, .navbar .nav > li > a:active:first-letter,
.navbar .nav > li.current-menu-item > a,
.navbar .nav > li.current-menu-ancestor > a,
.navbar .nav > li.current-menu-item > a:first-letter,
.navbar .nav > li.current-menu-ancestor > a:first-letter {
color:#0099CC;
text-shadow: none;
}
#menu-abc .dropdown-menu > li > a {
color: #48C2C5;
background: white;
}
.dropdown ul li {
color:#0099CC;
}
#menu-abc .dropdown ul ul li a {
font-size:14px;
color:#0099CC;
}
#menu-abc .navbar .nav > li.current-menu-item > a, .navbar .nav > li.current-menu-ancestor > a,
.navbar .nav > li > a:hover, .navbar .nav > li > a:focus {
color: #red;
}
#menu-abc {background-color: #48C2C5; border-bottom: none;box-shadow: 3px 3px 10px 1px #green;}
#menu-abc .container-fluid {padding: 20;}
#menu-abc .navbar { min-height: 15px; background-color: #48C2C5;}
#menu-abc a {padding-right: 0px; font-family: Perpetua; font-size: 18px; font-weight: bold;}
#menu-abc a:hover {color: #red;}
.dropdown:hover .dropdown-menu {font-size: 14px; display: inline; }
.dropdown-menu > li > a {
background: #48C2C5;
border-bottom: none; }
#menu-abc {background-color: #48C2C5; border-bottom: none;box-shadow: 3px 3px 10px 1px #white;}
#menu-abc .container-fluid {padding: 0;}
#menu-abc .navbar { min-height: 15px; background-color: #48C2C5;}
#menu-abc a {padding-right: 25px; font-family: Perpetua; font-size: 18px; font-weight: bold;}
#menu-abc a:hover {color: #red;}
#menu-abc .dropdown:hover .dropdown-menu {display: block;}
.dropdown-content {
min-width: 160px;}
#menu-abc .navbar-default .navbar-collapse, #menu-abc .navbar-default .navbar-form {background-color: #48C2C5;}
#menu-abc .navbar-default {width: auto; margin-left: auto; margin-right: auto; border: none;}
#menu-abc .dropdown-menu a {color:#0099CC;}
#menu-abc .dropdown-menu a:hover {background-color: #yellow;}
#menu-abc .dropdown-menu .divider {background-color: #48C2C5;}
#menu-abc .navbar-default .navbar-nav > .open > a {color: #48C2C5; background-color: #yellow;}
#menu-abc .navbar-default .navbar-nav > li.open > a {color: #yellow; background-color: #48C2C5;}
#menu-abc .navbar-nav .dropdown:hover > a[data-toggle=dropdown] + .dropdown-menu {display: block;}
#menu-abc .navbar-nav .dropdown.open > a[data-toggle=dropdown] + .dropdown-menu {display: block;}
/*Main Content Area*/
#s-lib-public-main .row {margin-bottom: 30px; margin-left: 5px;}
<title></title>
</head>
<body class="s-lg-guide-body">
<!-- BEGIN: Page Header -->
<meta content="97a72cc605382e45-5c9ddd9618eb904f-gad80e90ba61d526a-e" name="google-translate-customization">
<div id="header-abc">
<div class="container-fluid" id="banner-abc">
<div class="row">
<div class="col-sm-6 center" id="col1">
<div class="row">
<div class="col-md-6" id="logo-abc">
<img height="100" src="https://libapps.s3.amazonaws.com/accounts/27400/images/bunche_new_logo.jpg">
</div><!--/logo-abc=-->
</div><!--/row-->
</div><!--/col1-->
<div class="col-sm-6" id="col0">
<div class="row">
<div class="col-md-7" id="search-cat">
<br>
</div><!--/row-->
</div><!--/col2-->
</div>
</div><!--/banner-abc-->
</div><!-- Menu -->
<div id="menu-abc">
<nav class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button class="navbar-toggle" data-target="#abc-navbar-collapse-1" data-toggle="collapse" type="button"><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="abc-navbar-collapse-1">
<ul class="nav navbar-nav">
<li>
My Account
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Find<span class="caret"></span></a>
<ul class="dropdown-menu">
<li>
Catalog
</li>
<li>
Library Map
</li>
<li class='sub'>
Databases
<ul>
<li>
Current Trials
</li>
</ul>
<ul>
<li>
Direct Access Resources
</li>
</ul>
</li>
<li>
Find a Journal
</li>
<li>
Ebooks
</li>
<li>
Virtual Periodical Reading Room
</li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Get Help<span class="caret"></span></a>
<ul class="dropdown-menu">
<li>
Research & Instruction Services
</li>
<li>
Ebook Virtual Library
</li>
<li>
Virtual Libraries
</li>
<li>
A - Z Journal List
</li>
<li>
Bibliographies
<ul>
<li>
Foreign Affairs Professional Reading List
</li>
</ul>
</li>
<li>
<a>Briefing Videos</a>
</li>
<li>
Copyright
</li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Library Services<span class="caret"></span></a>
<ul class="dropdown-menu">
<li>
My Library Account
<ul>
<li>
How to Create an Account
</li>
</ul>
</li>
<li>
Acquisitions and Procurement
<ul>
<li>
DS-2092
</li>
</ul>
</li>
<li>
Interlibrary Loan
</li>
<li>
Map Services
</li>
<li>
Instruction
</li>
<li>
Donations
</li>
<li>
Booking the Rare Book Room
</li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">About Us<span class="caret"></span></a>
<ul class="dropdown-menu">
<li>
Mission and Vision
</li>
<li>
Library Staff
</li>
<li>
Policies
<ul>
<li>
Circulation
</li>
</ul>
<ul>
<li>
Collection Development
</li>
</ul>
</li>
<li>
Who was Ralph Bunche?
</li>
<li>
Rare Book Collection
</li>
<li>
5 FAM 1400
</li>
<li class="divider"></li>
<li>
Office of Information Programs and Services
</li>
</ul>
</li>
<li style="float:right;">
<a href="#</a>
</li>
<li style="float:right;">
A/GIS/IPS
</li>
</ul><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</div>
</nav>
</div><!-- END: Page Header Without Encore -->
<!-- END: Page Header -->
</div>
</body>
</html>
I know LibGuides use Bootstrap 3, so instead of the float right on the last two list items, I've placed a pull-right class. I also set the UL element to stretch to 100%. The answer below only includes the HTML, not the CSS, but give it a try:
<div id="header-abc">
<div class="container-fluid" id="banner-abc">
<div class="row">
<div class="col-sm-6 center" id="col1">
<div class="row">
<div class="col-md-6" id="logo-abc">
<img height="100" src="https://libapps.s3.amazonaws.com/accounts/27400/images/bunche_new_logo.jpg">
</div><!--/logo-abc=-->
</div><!--/row-->
</div><!--/col1-->
<div class="col-sm-6" id="col0">
<div class="row">
<div class="col-md-7" id="search-cat">
<br>
</div><!--/row-->
</div><!--/col2-->
</div>
</div><!--/banner-abc-->
</div><!-- Menu -->
<div id="menu-abc">
<nav class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button class="navbar-toggle" data-target="#abc-navbar-collapse-1" data-toggle="collapse" type="button"><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="abc-navbar-collapse-1">
<ul class="nav navbar-nav" style="width:100%;">
<li>
My Account
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Find<span class="caret"></span></a>
<ul class="dropdown-menu">
<li>
Catalog
</li>
<li>
Library Map
</li>
<li class='sub'>
Databases
<ul>
<li>
Current Trials
</li>
</ul>
<ul>
<li>
Direct Access Resources
</li>
</ul>
</li>
<li>
Find a Journal
</li>
<li>
Ebooks
</li>
<li>
Virtual Periodical Reading Room
</li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Get Help<span class="caret"></span></a>
<ul class="dropdown-menu">
<li>
Research & Instruction Services
</li>
<li>
Ebook Virtual Library
</li>
<li>
Virtual Libraries
</li>
<li>
A - Z Journal List
</li>
<li>
Bibliographies
<ul>
<li>
Foreign Affairs Professional Reading List
</li>
</ul>
</li>
<li>
<a>Briefing Videos</a>
</li>
<li>
Copyright
</li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Library Services<span class="caret"></span></a>
<ul class="dropdown-menu">
<li>
My Library Account
<ul>
<li>
How to Create an Account
</li>
</ul>
</li>
<li>
Acquisitions and Procurement
<ul>
<li>
DS-2092
</li>
</ul>
</li>
<li>
Interlibrary Loan
</li>
<li>
Map Services
</li>
<li>
Instruction
</li>
<li>
Donations
</li>
<li>
Booking the Rare Book Room
</li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">About Us<span class="caret"></span></a>
<ul class="dropdown-menu">
<li>
Mission and Vision
</li>
<li>
Library Staff
</li>
<li>
Policies
<ul>
<li>
Circulation
</li>
</ul>
<ul>
<li>
Collection Development
</li>
</ul>
</li>
<li>
Who was Ralph Bunche?
</li>
<li>
Rare Book Collection
</li>
<li>
5 FAM 1400
</li>
<li class="divider"></li>
<li>
Office of Information Programs and Services
</li>
</ul>
</li>
<li class="pull-right">
Knowledge Portal
</li>
<li class="pull-right">
A/GIS/IPS
</li>
</ul><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</div>
</nav>
</div><!-- END: Page Header Without Encore -->
<!-- END: Page Header -->
</div>
You problem is with this css code:
ul {text-align: right; width: 100%; background-color: #48C2C5;}
It will affected all the same element or recursively to all it's child element.
To solved this you can add additional id or class on the affected element to make it unique:
ul.unique {text-align: right; width: 100%; background-color: #48C2C5;}
or overwrite style on unwanted affected element only:
ul li.sub-menu {text-align: left;}
I have a Bootstrap menu that that is slightly aligned to the left for some reason, I can't debug it. It doesn't have any rows, but the container is fluid and changing this to fixed makes it unresponsive in mobiles.
This is the live example. https://codepen.io/anon/pen/qjKbQM
This is the HTML code:
<nav class="navbar navbar-default" style="border:1px solid red";>
<div class="container-fluid">
<div class="container">
<!-- 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="#">UP</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">
<li><span class="glyphicon glyphicon-th" aria-hidden="true"></span> DEVIS GRATUIT</li>
<li class="dropdown">
Nos Ressource <span class="caret"></span>
<ul class="dropdown-menu">
<li>
Toutes nos ressources
</li>
<li>
Fiches conseils
</li>
<li>
Fiches métiers
</li>
<li>
Foire aux questions
</li>
<li>
Revue de presse
</li>
<li>
Le Blog
</li>
</ul>
</li>
<li class="dropdown">
Nos Fonctionalites <span class="caret"></span>
<ul class="dropdown-menu">
<li>
Toutes nos fonctionnalités
</li>
<li class="">
Mes indicateurs
</li>
<li class="">
Ma comptabilité
</li>
<li class="">
Mes devis et factures
</li>
<li class="">
Mon budget
</li>
<li>
Mon social-RH
</li>
<li class="">
Mon coffre-fort
</li>
</ul>
</li>
<li>Accounts</li>
<li class="dropdown">
Notre Cabinet <span class="caret"></span>
<ul class="dropdown-menu">
<li>
Tout sur notre cabinet
</li>
<li class="">
Qui sommes-nous ?
</li>
<li>
Pourquoi nous choisir ?
</li>
<li>
Comment devenir client ?
</li>
<li>
Notre équipe
</li>
<li>
Vos questions, nos réponses
</li>
<li class="">
Témoignages clients
</li>
<li class="">
Recrutement
</li>
</ul>
</li>
<li class="dropdown">
Nos Solutions <span class="caret"></span>
<ul class="dropdown-menu">
<li>
Toutes nos solutions
</li>
<li class="">
TPE / Consultants
</li>
<li>
Porteurs de projet
</li>
<li>
SCI / Locations meublées
</li>
<li class="">
Paye des salariés
</li>
<li class="">
Professions Libérales
</li>
<li class="">
Associations
</li>
<li class="">
Toutes nos solutions
</li>
</ul>
</li>
</ul>
</div><!-- /.navbar-collapse -->
</div>
</div><!-- /.container-fluid -->
</nav>
And this is the css :
.navbar-default {
font-size: 1.15em;
font-weight: 400;
border: 0px;
border-radius: 0px;
background: #021a2f !important;
}
.navbar-default .navbar-nav>li>a {
color: white;
}
.navbar-default .navbar-nav>li>a:hover {
color: #cbf0ff;
}
.navbar-default .navbar-brand {
color: #002433;
}
.navbar-default .navbar-brand:hover {
color: #ffffff;
text-shadow: 1px -1px 8px #b3e9ff;
}
.navbar-default .navbar-nav>.open>a, .navbar-default .navbar-nav>.open>a:hover, .navbar-default .navbar-nav>.open>a:focus {
background-color: #004059;
color: white;
}
.navbar-default .navbar-toggle {
border: none;
}
.navbar-default .navbar-collapse, .navbar-default .navbar-form {
border: none;
}
.navbar-default .navbar-toggle:hover, .navbar-default .navbar-toggle:focus {
background-color: #002433;
}
.navbar-default .navbar-toggle .icon-bar {
}
.dropdown-menu {
background-color: #004059;
color: white;
border: 0px;
border-radius: 2px;
padding-top: 10px;
padding-bottom: 10px;
}
.dropdown-menu>li>a {
background-color: #004059;
color: white;
}
.dropdown-menu>li>a:hover, .dropdown-menu>li>a:focus {
background-color: #004059;
color:white;
}
.dropdown-menu .divider {
height: 1px;
margin: 9px 0;
overflow: hidden;
background-color: #003246;
}
.navbar-default .navbar-nav .open .dropdown-menu>li>a {
color: #ffffff;
}
#media (max-width: 767px) {
.dropdown-menu>li>a {
background-color: #006b96;
color: #ffffff;
}
.dropdown-menu>li>a:hover {
color: #ffffff;
}
.navbar-default .navbar-nav .open .dropdown-menu>li>a:focus, .navbar-default .navbar-nav .open .dropdown-menu>li>a:hover {
color: #ffffff;
background-color: transparent;
}
.dropdown-menu .divider {
height: 1px;
margin: 9px 0;
overflow: hidden;
background-color: #005577;
}
}
How can I make the menus be centered without loosing the responsiveness of the navbar?
Add below css to get
.nav.customCl {
display: flex;
justify-content: center;
align-items: center;
flex-flow: row wrap;
}
And use this class in following html
<ul class="nav navbar-nav customCl"
codepen link
I have a dropdown menu from the navbar and it has right-aligned (css class pull-right) glyphicons. One of the menu items is a bit longer than the others and it runs into the glyphicon, causing it to be moved down a half-line:
I can obviously set the width of this dropdown manually with a CSS class and a hardcoded width, but I'd rather get Bootstrap to incorporate the glyphicon width appropriately. How do I need to structure my HTML or what changes to CSS do I need to make to make this work?
Here's the HTML for the entire navbar:
<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="/">
<span>
<img id="XXX-brand-logo" alt="Brand" src="/Content/Images/XXX.png" width="20" height="20"></span>
Home
</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-left">
<li>
XXX
</li>
<li class="dropdown">
XXX<span class="caret"></span>
<ul class="dropdown-menu">
<li>XXX</li>
<li>XXX</li>
</ul>
</li>
<li class="dropdown">
XXX<span class="caret"></span>
<ul class="dropdown-menu">
<li>XXX</li>
<li>XXX</li>
</ul>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
Admin<span class="caret"></span>
<ul class="dropdown-menu">
<li>Manage Roles</li>
<li>Manage Groups</li>
<li>Manage Users</li>
</ul>
</li>
<li class="dropdown">
<span class="glyphicon glyphicon-user"></span> Administrator<span class="caret"></span>
<ul class="dropdown-menu">
<li>Settings <span class="glyphicon glyphicon-wrench pull-right"></span></li>
<li>Change Password <span class="glyphicon glyphicon-lock pull-right"></span></li>
<li role="separator" class="divider"></li>
<li>Logout <span class="glyphicon glyphicon-log-out pull-right"></span></li>
</ul>
</li>
</ul>
</div>
</div>
And here's any CSS that could possible modify this page:
body {
padding-top: 50px;
padding-bottom: 20px;
}
/* Set padding to keep content from hitting the edges */
.body-content {
padding-left: 15px;
padding-right: 15px;
}
.glyphicon-hover {
border-radius: 25px;
border: 1px solid transparent;
padding: 2px;
}
.glyphicon-hover:hover, .glyphicon:focus {
border-radius: 5px;
border: 1px solid black;
color: red;
}
I'm using jquery-ui.css (version 1.11.4 via jQuery.UI.Combined in Nuget) and bootstrap.css (version 3.3.6.1 via Nuget).
Rearranging your markup to place the icon before the anchor text (this will circumvent the "step-down" effect), then wrapping the anchor text in another nested tag that you can target to apply further styling will help in resolving the issue at hand.
HTML
<ul class="dropdown-menu ">
<li><span class="glyphicon glyphicon-wrench pull-right "></span><span class="dropdown-link-text ">Settings</span>
</li>
<li><span class="glyphicon glyphicon-lock pull-right "></span><span class="dropdown-link-text ">Change Password</span>
</li>
<li role="separator " class="divider "></li>
<li><span class="glyphicon glyphicon-log-out pull-right "></span><span class="dropdown-link-text ">Logout</span>
</li>
</ul>
CSS
.dropdown-link-text {
display: inline-block;
margin-right: 20px;
}
Working example: http://www.bootply.com/wMD9IaHs4R
Alternatively, you could also try adding the icons in as pseudo elements of the link tag itself, then position them absolute and adjust the top, right values accordingly.
I've used this CSS instead of the .pull-right class:
#media (min-width: 768px) {
.navbar-right .dropdown-menu > li > a {
padding-right: 46px;
position: relative;
}
.navbar-right .dropdown-menu > li > a > .glyphicon {
display: block;
position: absolute;
right: 20px;
top: 5px;
}
}
Please check the result. Is it what you want to achieve?
#import url('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css');
body {
padding-top: 50px;
padding-bottom: 20px;
}
/* Set padding to keep content from hitting the edges */
.body-content {
padding-left: 15px;
padding-right: 15px;
}
.glyphicon-hover {
border-radius: 25px;
border: 1px solid transparent;
padding: 2px;
}
.glyphicon-hover:hover, .glyphicon:focus {
border-radius: 5px;
border: 1px solid black;
color: red;
}
#media (min-width: 768px) {
.navbar-right .dropdown-menu > li > a {
padding-right: 46px;
position: relative;
}
.navbar-right .dropdown-menu > li > a > .glyphicon {
display: block;
position: absolute;
right: 20px;
top: 5px;
}
}
<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="/">
<span>
<img id="XXX-brand-logo" alt="Brand" src="/Content/Images/XXX.png" width="20" height="20"></span>
Home
</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-left">
<li>
XXX
</li>
<li class="dropdown">
XXX<span class="caret"></span>
<ul class="dropdown-menu">
<li>XXX</li>
<li>XXX</li>
</ul>
</li>
<li class="dropdown">
XXX<span class="caret"></span>
<ul class="dropdown-menu">
<li>XXX</li>
<li>XXX</li>
</ul>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
Admin<span class="caret"></span>
<ul class="dropdown-menu">
<li>Manage Roles</li>
<li>Manage Groups</li>
<li>Manage Users</li>
</ul>
</li>
<li class="dropdown">
<span class="glyphicon glyphicon-user"></span> Administrator<span class="caret"></span>
<ul class="dropdown-menu">
<li><span class="glyphicon glyphicon-wrench"></span>Settings</li>
<li><span class="glyphicon glyphicon-lock"></span>Change Password</li>
<li role="separator" class="divider"></li>
<li><span class="glyphicon glyphicon-log-out"></span>Logout</li>
</ul>
</li>
</ul>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
The simplest solution is to line break the text
Change<br>Password
This leaves all elements and the menu the same size horizontally. The second simple solution is to change the width
.glyphicon {
padding-left: 10px;
}
Please hvae a look at the below code
<div id="main-sidebar-wrapper" style="margin-top:50px; width:150px;">
<ul class="sidebar-nav" style="margin-top:10px;">
<!-- <li> Face Sheet </li> -->
<li class="li_active"> History </li>
<li> Problems </li>
<li> Medications </li>
<!-- <li> Immunizations </li> -->
<li > Allergies </li>
<li> Vitals </li>
<li> Examinations </li>
<li > Counseling </li>
<li> Demographics </li>
<hr>
<li>Documents Upload
<ul class="sub-menu">
<li>E.C.G</li>
</ul>
</li>
<!-- <li> Documents </li> -->
</ul>
</div>
Here, the Documents Upload section, I want it to be a drop-up menu or drop-right side menu. How can I do this?
#media (min-width: 768px) {
.navbar-collapse {
height: auto;
border-top: 0;
box-shadow: none;
max-height: none;
padding-left:0;
padding-right:0;
}
.navbar-collapse.collapse {
display: block !important;
width: auto !important;
padding-bottom: 0;
overflow: visible !important;
}
.navbar-collapse.in {
overflow-x: visible;
}
.navbar
{
max-width:300px;
margin-right: 0;
margin-left: 0;
}
.navbar-nav,
.navbar-nav > li,
.navbar-left,
.navbar-right,
.navbar-header
{float:none !important;}
.navbar-right .dropdown-menu {left:0;right:auto;}
.navbar-collapse .navbar-nav.navbar-right:last-child {
margin-right: 0;
}
}
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<!-- Jquery CDN -->
<script src="https://code.jquery.com/jquery-2.1.2.min.js"></script>
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<nav class="navbar navbar-default" role="navigation">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" 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>
<a class="navbar-brand" href="#">Brand</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav">
<li class="active">Link</li>
<li>Link</li>
<li class="dropdown">
Dropdown <b class="caret"></b>
<ul class="dropdown-menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li>Separated link</li>
<li>One more separated link</li>
</ul>
</li>
</ul>
<form class="navbar-form navbar-left" role="search">
<div class="form-group">
<input type="text" class="form-control" placeholder="Search">
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
</div><!-- /.navbar-collapse -->
</nav>
Please find updated fiddle.
Need to do some change in
<li>Documents Upload
<ul class="sub-menu">
<li>E.C.G</li>
</ul>
</li>
I have made required changes. Please go through the link.
This is similar to how the dropdown menus work on mobile, may help.
body,
html {
height: 100%;
}
.sidebar-fixed {
padding: 5px 18px;
position: fixed;
width: 175px;
height: 100%;
top: 0;
left: 0;
background: #f5f5f5;
}
.sidebar-fixed #drop-one {
list-style: none;
text-align: left;
}
.sidebar-fixed #drop-one > li {
padding-top: 10px;
font-size: 13px;
}
.sidebar-fixed #drop-one > li >a {
color: #555;
text-decoration: none;
}
ul.sidebar-list {
list-style: none;
display: inline;
text-align: left;
}
ul.sidebar-list > li {
font-size: 18px;
padding-bottom: 25px;
}
ul.sidebar-list > li > a {
color: #555;
text-decoration: none;
}
.main-content {
margin-left: 175px;
padding-top: 5px;
}
<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" />
<div class="sidebar-fixed" id="sideNavParent">
<ul class="sidebar-list">
<li> Sidebar
</li>
<li> Something
</li>
<li> Something <span class="caret"></span>
<ul id="drop-one" class="collapse" data-parent="#sideNavParent">
<li> Something
</li>
<li> Something
</li>
<li> Something
</li>
<li> Something
</li>
</ul>
</li>
</ul>
</div>
<div class="main-content">
<div class="container-fluid">
<div class="alert alert-info">Main Content</div>
</div>
</div>
I have two navbar containers on my page.
Originally, navbar1 stays on top of navbar2, but after I shrink the page and the responsive style come to have effect, I need navbar2 to be on top of nabvar1
Here's a link to my demo: click
Here's an example of what I have:
Here's an example of what I need:
Update
CSS Code Snippet
.navbar
{
margin-bottom: 3px;
}
.btn-group
{
float: right;
}
/*****************************************************/
/*************** LEFT NAV CUSTOM STYLES **************/
/*****************************************************/
.navbar-inner-left
{
padding-right: 0;
padding-left: 0;
}
.navbar-left{}
.navbar-left .nav > li
{
float: none;
}
.navbar-inner-left div > .nav-list
{
padding-left: 0;
}
.navbar-inner-left .container-fluid > .brand
{
padding: 10px 5px 10px 5px;
}
.navbar-inner-left
{
border: none;
background-color: #ffffff;
background-image: -moz-linear-gradient(top,#ffffff,#ffffff);
background-image: -webkit-gradient(linear,0 0,0 100%,from(#ffffff),to(#ffffff));
background-image: -webkit-linear-gradient(top,#ffffff,#ffffff);
background-image: -o-linear-gradient(top,#ffffff,#ffffff);
background-image: linear-gradient(to bottom,#ffffff,#ffffff);
border: none;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff',endColorstr='#ffffffff',GradientType=0);
-webkit-box-shadow: 0;
-moz-box-shadow: 0;
box-shadow: 0;
}
/************************************************* RESPONSIVE STUFFF**************************************************************/
/************************************************* RESPONSIVE STUFFF**************************************************************/
/************************************************* RESPONSIVE STUFFF**************************************************************/
/************************************************* RESPONSIVE STUFFF**************************************************************/
/************************************************* RESPONSIVE STUFFF**************************************************************/
/************************************************* RESPONSIVE STUFFF**************************************************************/
#media (min-width: 1200px){}
#media (min-width: 980px){}
#media (max-width: 979px){}
#media (max-width: 767px){}
#media (min-width: 768px) and (max-width: 979px)
{
.navbar-left .btn-navbar
{
margin-right: -15px;
}
.navbar-inner-left .container-fluid > .brand
{
float: left;
}
}
#media (max-width: 767px) and (min-width: 480px)
{
.nav-collapse .nav > li > a, .nav-collapse .dropdown-menu a
{
padding-left: 30px;
}
.navbar-inner-left .container-fluid > .brand
{
padding-left: 30px;
}
.navbar-inner-left .nav-list > .nav-header
{
padding-left: 20px;
}
.navbar-left .btn-navbar
{
margin-right: 26px;
}
}
#media (max-width: 480px)
{
.nav-collapse .nav > li > a, .nav-collapse .dropdown-menu a
{
padding-left: 30px;
}
.navbar-inner-left .container-fluid > .brand
{
padding-left: 30px;
}
.navbar-inner-left .nav-list > .nav-header
{
padding-left: 20px;
}
.navbar-left .btn-navbar
{
margin-right: 26px;
}
}
HTML Code Snippet
<div class="container-fluid">
<div class="row-fluid">
<div class="span2">
<img alt="140x140" src="http://lorempixel.com/140/140/" />
<div class="navbar navbar-left">
<div class="navbar-inner navbar-inner-left">
<div class="container-fluid">
<a data-target=".navbar-responsive-collapse" data-toggle="collapse" class="btn btn-navbar">
<span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar">
</span></a>Main Menu
<div class="nav-collapse collapse navbar-responsive-collapse">
<ul class="nav nav-list">
<li class="nav-header">List header </li>
<li>Home </li>
<li>Library </li>
<li>Applications </li>
<li class="nav-header">Another list header </li>
<li>Profile </li>
<li>Settings </li>
<li class="divider"></li>
<li>Help </li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="span10">
<div class="navbar">
<div class="navbar-inner">
<div class="container-fluid">
<a data-target=".navbar-responsive-collapse" data-toggle="collapse" class="btn btn-navbar">
<span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar">
</span></a>Title
<div class="nav-collapse collapse navbar-responsive-collapse">
<ul class="nav">
<li class="dropdown"><a data-toggle="dropdown" class="dropdown-toggle" href="#">Dropdown<strong
class="caret"></strong></a>
<ul class="dropdown-menu">
<li>Action </li>
<li>Another action </li>
<li>Something else here </li>
<li class="divider"></li>
<li class="nav-header">Nav header </li>
<li>Separated link </li>
<li>One more separated link </li>
</ul>
</li>
<li class="dropdown"><a data-toggle="dropdown" class="dropdown-toggle" href="#">Dropdown<strong
class="caret"></strong></a>
<ul class="dropdown-menu">
<li>Action </li>
<li>Another action </li>
<li>Something else here </li>
<li class="divider"></li>
<li class="nav-header">Nav header </li>
<li>Separated link </li>
<li>One more separated link </li>
</ul>
</li>
<li class="dropdown"><a data-toggle="dropdown" class="dropdown-toggle" href="#">Dropdown<strong
class="caret"></strong></a>
<ul class="dropdown-menu">
<li>Action </li>
<li>Another action </li>
<li>Something else here </li>
<li class="divider"></li>
<li class="nav-header">Nav header </li>
<li>Separated link </li>
<li>One more separated link </li>
</ul>
</li>
<li class="dropdown"><a data-toggle="dropdown" class="dropdown-toggle" href="#">Dropdown<strong
class="caret"></strong></a>
<ul class="dropdown-menu">
<li>Action </li>
<li>Another action </li>
<li>Something else here </li>
<li class="divider"></li>
<li class="nav-header">Nav header </li>
<li>Separated link </li>
<li>One more separated link </li>
</ul>
</li>
</ul>
<ul class="nav pull-right">
<li>Link </li>
<li class="divider-vertical"></li>
<li class="dropdown"><a data-toggle="dropdown" class="dropdown-toggle" href="#">Dropdown<strong
class="caret"></strong></a>
<ul class="dropdown-menu">
<li>Action </li>
<li>Another action </li>
<li>Something else here </li>
<li class="divider"></li>
<li>Separated link </li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="btn-group">
<button class="btn" type="button">
<em class="icon-align-left"></em>
</button>
<button class="btn" type="button">
<em class="icon-align-center"></em>
</button>
<button class="btn" type="button">
<em class="icon-align-right"></em>
</button>
<button class="btn" type="button">
<em class="icon-align-justify"></em>
</button>
</div>
</div>
</div>
</div>
Thanks in Advance!
.navbar-left {
position: relative;
top: 88px;
}
.navbar-inner {
position: relative;
top: -44px;
}
And put that in the media query block you want to swap them in.
Having looked at your code i would use jQuery. I'm on a mobile device and can not access your jsfiddle at the moment. But to move a div from one place to another you would just do this in jQuery
$("#source")
.appendTo("#destination");
EDITED
if ( $(window).width() < 959) {
$("#source")
.appendTo("#destination");
}