Phantom spacing with collapsible side nav and Bootstrap 3 - html

I'm having a little trouble getting a collapsible side nav built with Bootstrap 3 to behave on a site I'm working on. I've started getting way too much vertical space between <li>s but I can't figure out where it's coming from. I thought it might be from Wordpress adding <p> and <br> tags and while that certainly isn't helping it also doesn't seem to be the primary problem.
A sample URL is:
http://cbipath.com/arabic/aa-tax-regulations-that-protect-the-rich/
And the code in question is:
(Note that this is still a work in progress, so it's rife with broken links etc.)
<div class="col-xs-6 col-sm-3 sidebar-offcanvas" id="sidebar" role="navigation">
<div class="sidebar-nav">
<p class="sidenav-header">
Units and Lessons:
</p>
<ul class="nav nav-list accordion" id="sidenav-accordion">
<li>
<div class="accordion-heading">
<a data-toggle="collapse" data-target="#content-areas"><span class="nav-header-primary">
Content Areas <i class="icon-chevron-right"></i>
</span></a>
</div>
<ul class="nav nav-list collapse" id="content-areas">
<li>All <i class="icon-chevron-right"></i>
</li>
<li>
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#content-areas" href="#nav-urban-planning"><span class="nav-header-secondary">
Urban Planning <i class="icon-chevron-right"></i></span></a>
</div>
<ul class="nav-tertiary nav-list collapse" id="nav-urban-planning">
<li>Introduction
</li>
<li>Urban Planning 1
</li>
<li>Urban Planning 2
</li>
<li>Urban Planning 3
</li>
<li>Urban Planning 4
</li>
</ul>
</li>
<li>
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#content-areas" href="#nav-sustainability"><span class="nav-header-secondary">
Sustainability <i class="icon-chevron-right"></i></span></a>
</div>
<ul class="nav-tertiary nav-list collapse" id="nav-sustainability">
<li>Introduction
</li>
<li>Sustainability 1
</li>
<li>Sustainability 2
</li>
<li>Sustainability 3
</li>
<li>Sustainability 4
</li>
</ul>
</li>
<li>
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#content-areas" href="#nav-public-administration"><span class="nav-header-secondary">
Public Administration <i class="icon-chevron-right"></i></span></a>
</div>
<ul class="nav-tertiary nav-list collapse" id="nav-public-administration">
<li>Introduction
</li>
<li>Public Administration 1
</li>
<li>Public Administration 2
</li>
<li>Public Administration 3
</li>
<li>Public Administration 4
</li>
</ul>
</li>
<li>
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#content-areas" href="#nav-health"><span class="nav-header-secondary">
Health <i class="icon-chevron-right"></i></span></a>
</div>
<ul class="nav-tertiary nav-list collapse" id="nav-health">
<li>Introduction
</li>
<li>Lesson: What is Epilepsy? (Turkish)
</li>
<li>Lesson: Pathology (Turkish)
</li>
</ul>
</li>
</ul>
<!-- End Content Areas Internal UL -->
</li>
<!-- End Content Areas List Item-->
<li>
<!-- Begin Languages List Item-->
<div class="accordion-heading">
<a data-toggle="collapse" data-target="#languages"><span class="nav-header-primary">
Languages <i class="icon-chevron-right"></i>
</span></a>
</div>
<ul class="nav nav-list collapse" id="languages">
<li>All <i class="icon-chevron-right"></i>
</li>
<li>
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#languages" href="#nav-arabic"><span class="nav-header-secondary">
Arabic <i class="icon-chevron-right"></i></span></a>
</div>
<ul class="nav-tertiary nav-list collapse" id="nav-arabic">
<li>Overview
</li>
<li>Education and Democracy in the Arab World
</li>
<li>Tax Regulations that Protect the Rich
</li>
<li>Minorities in the Arab World
</li>
<li>Revolution, Equality, and Women's Rights
</li>
</ul>
</li>
<li>
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#languages" href="#nav-turkish"><span class="nav-header-secondary">
Turkish <i class="icon-chevron-right"></i></span></a>
</div>
<ul class="nav-tertiary nav-list collapse" id="nav-turkish">
<li>Overview
</li>
<li>Lesson: What is Epilepsy?
</li>
<li>Lesson: Pathology
</li>
<li>Lesson: Pathology
</li>
</ul>
</li>
<li>
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#languages" href="#nav-hebrew"><span class="nav-header-secondary">
Hebrew <i class="icon-chevron-right"></i></span></a>
</div>
<ul class="nav-tertiary nav-list collapse" id="nav-hebrew">
<li>Overview
</li>
<li>Israel's Declaration of Independence
</li>
</li>
</ul>
</li>
</ul>
</li>
<!-- End Languages List Item-->
</ul>
</div>
I've been staring at this for awhile now -- any help would be appreciated.
EDIT: To be more specific -- I'd like to decrease the vertical space between the items. They seem to be getting arbitrarily high heights but when I try to specify a height it breaks the collapse action.

Answering my own here:
This was caused by <br> tags getting inserted into the code. This comes up from time to time with Wordpress and can usually be handled by adding two lines of code to functions.php as instructed here:
http://codex.wordpress.org/Function_Reference/wpautop
I have that in my functions.php, so it seems likely that they were being inserted due to a plugin (I haven't definitively figured out which one yet). A temporary fix is adding:
.sidebar-nav br {
display: none;
}
to the custom CSS file. It seems likely these are getting added by the PageBuilder plugin by SiteOrigin which is otherwise a really great plugin. I'll update here if I'm able to definitively establish that.

Related

How to keep the selected accordion active on page reload

I am using materialize collapsible for my navigation. Everything works fine except when I reload the page. The collapsible gets closed and I have to manually make it active again. How do I make the collapsible remain active on page reload?
Here's my code:
<ul id="slide-out" class="side-nav fixed leftside-navigation">
<ul class="collapsible" data-collapsible="expandable">
<li>
<a class="collapsible-header">
<i class="material-icons">home</i> Home
</a>
<div class="collapsible-body">
<ul>
<li ui-sref-active="active">
<a ui-sref="protect" ui-sref-opts="{reload: true}">
<i class="material-icons">dashboard</i> Dashboard
</a>
</li>
<li ui-sref-active="active">
<a ui-sref="store" ui-sref-opts="{reload: true}">
<i class="material-icons">cloud_done</i> Storage
</a>
</li>
</ul>
</div>
</li>
<li>
<a class="collapsible-header">
<i class="material-icons">event_available</i>Manage
</a>
<div class="collapsible-body">
<ul>
<li ui-sref-active="active">
<a ui-sref="manage" ui-sref-opts="{reload: true}">
<i class="material-icons">storage</i> Manage Storage
</a>
</li>
<li ui-sref-active="active">
<a ui-sref="enroll" ui-sref-opts="{reload: true}">
<i class="material-icons">file_download</i> Enroll
</a>
</li>
</ul>
</div>
</li>
</ul>
</ul>
What you want to do concerns program state, hence there's no way for you to do that unless you save the name or id of the active accordion. which can easily be done using browser local storage.

Cant quite get mobile navbar working

Trying to make my mobile navbar not coming out quite right. Anyone see the problem? I have only a couple months experience, need a quick hand of help. Much appreciated!
As you can see it doesnt display the navbar right at all. The contact page isnt clickable.Its missing the Services link
*******************
NAV MENU MOBILE
*******************
-->
<div class="menu-wrap mobile">
<div class="container">
<div class="row">
<div class="col-sm-3 no-padding">
<img src="img/logo.png" alt="logo" class="logo-menu">
</div>
<div class="col-sm-9 col-lg-7 col-lg-offset-2 no-padding">
<nav class="nav-menu">
<button class="menu-toggle">
<span class="icon"></span>
<span class="icon"></span>
<span class="icon"></span>
</button>
<ul class="main-menu">
<li class="menu-item active menu-item-has-children">
Home
</li>
<li class="menu-item menu-item-has-children">
<a>Hosting</a>
<ul class="sub-menu">
<li class="menu-item">Shared Hosting</li>
<li class="menu-item">Reseller Hosting</li>
<li class="menu-item">Cloud VPS</li>
<li class="menu-item">Dedicated Server</li>
</ul>
</li>
<li class="menu-item">
Domains
</li>
<li class="menu-item menu-item-has-children">
<a href="blog.html>Blog</a>
</li>
<li class="menu-item menu-item-has-children">
<a href="services.html>Services</a>
</li>
<li class="menu-item menu-last">
<a class="menu-item" href="contact.html">Contact</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
</div>
navbar
<a href="services.html>Services</a>
should be
Services
You left out the second ".
In those two links...
<a href="blog.html>Blog</a>
<a href="services.html>Services</a>
...the closing quote of the hrefattribute is missing. Should be
Blog
Services

css not showing correctly asp.net mvc

hi i'm working on a admin template. I converted the html codes into mvc structure. Now i am stuck , when i create a page using the layout in the shared folder the footer goes up to the navigation bar. for more understanding check the screenshot
here is my _layoutadmin.cshtml
<div class="container body">
<div class="main_container">
<div class="col-md-3 left_col">
<div class="left_col scroll-view">
<div class="navbar nav_title" style="border: 0;">
<i class="fa fa-paw"></i> <span>Admin Panel</span>
</div>
<div class="clearfix"></div>
<!-- menu prile quick info -->
<div class="profile">
<div class="profile_pic">
<img src="~/Content/admin/AdminLogo.jpg" alt="..." class="img-circle profile_img"/>
#*<img src="images/img.jpg" alt="..." class="img-circle profile_img">*#
</div>
<div class="profile_info">
<span>Welcome,</span>
<h2>John Doe</h2>
</div>
</div>
<!-- /menu prile quick info -->
<br />
<!-- sidebar menu -->
<div id="sidebar-menu" class="main_menu_side hidden-print main_menu">
<div class="menu_section">
<h3>General</h3>
<ul class="nav side-menu">
<li>
<a><i class="fa fa-home"></i> Home <span class="fa fa-chevron-down"></span></a>
<ul class="nav child_menu" style="display: none">
<li>
Dashboard
</li>
<li>
Dashboard2
</li>
<li>
Dashboard3
</li>
</ul>
</li>
<li>
<a><i class="fa fa-edit"></i> Forms <span class="fa fa-chevron-down"></span></a>
<ul class="nav child_menu" style="display: none">
<li>
General Form
</li>
<li>
Advanced Components
</li>
<li>
Form Validation
</li>
<li>
Form Wizard
</li>
<li>
Form Upload
</li>
<li>
Form Buttons
</li>
</ul>
</li>
<li>
<a><i class="fa fa-desktop"></i> UI Elements <span class="fa fa-chevron-down"></span></a>
<ul class="nav child_menu" style="display: none">
<li>
General Elements
</li>
<li>
Media Gallery
</li>
<li>
Typography
</li>
<li>
Icons
</li>
<li>
Glyphicons
</li>
<li>
Widgets
</li>
<li>
Invoice
</li>
<li>
Inbox
</li>
<li>
Calender
</li>
</ul>
</li>
<li>
<a><i class="fa fa-table"></i> Tables <span class="fa fa-chevron-down"></span></a>
<ul class="nav child_menu" style="display: none">
<li>
Tables
</li>
<li>
Table Dynamic
</li>
</ul>
</li>
<li>
<a><i class="fa fa-bar-chart-o"></i> Data Presentation <span class="fa fa-chevron-down"></span></a>
<ul class="nav child_menu" style="display: none">
<li>
Chart JS
</li>
<li>
Chart JS2
</li>
<li>
Moris JS
</li>
<li>
ECharts
</li>
<li>
Other Charts
</li>
</ul>
</li>
</ul>
</div>
<div class="menu_section">
<h3>Live On</h3>
<ul class="nav side-menu">
<li>
<a><i class="fa fa-bug"></i> Additional Pages <span class="fa fa-chevron-down"></span></a>
<ul class="nav child_menu" style="display: none">
<li>
E-commerce
</li>
<li>
Projects
</li>
<li>
Project Detail
</li>
<li>
Contacts
</li>
<li>
Profile
</li>
</ul>
</li>
<li>
<a><i class="fa fa-windows"></i> Extras <span class="fa fa-chevron-down"></span></a>
<ul class="nav child_menu" style="display: none">
<li>
404 Error
</li>
<li>
500 Error
</li>
<li>
Plain Page
</li>
<li>
Login Page
</li>
<li>
Pricing Tables
</li>
</ul>
</li>
<li>
<a><i class="fa fa-laptop"></i> Landing Page <span class="label label-success pull-right">Coming Soon</span></a>
</li>
</ul>
</div>
</div>
<!-- /sidebar menu -->
</div>
</div>
<!-- top navigation -->
<div class="top_nav">
<div class="nav_menu">
<nav class="" role="navigation">
<div class="nav toggle">
<a id="menu_toggle"><i class="fa fa-bars"></i></a>
</div>
<ul class="nav navbar-nav navbar-right">
<li class="">
<a href="javascript:;" class="user-profile dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<img src="images/img.jpg" alt="">John Doe
<span class=" fa fa-angle-down"></span>
</a>
<ul class="dropdown-menu dropdown-usermenu animated fadeInDown pull-right">
<li>
Profile
</li>
<li>
<a href="javascript:;">
<span class="badge bg-red pull-right">50%</span>
<span>Settings</span>
</a>
</li>
<li>
Help
</li>
<li>
<i class="fa fa-sign-out pull-right"></i> Log Out
</li>
</ul>
</li>
</ul>
</nav>
</div>
</div>
<!-- /top navigation -->
<!-- page content -->
<div class="right_col" role="main">
<!-- top tiles -->
#RenderBody()
<!-- footer content -->
<footer>
<div class="copyright-info">
<p class="pull-right">
Gentelella - Bootstrap Admin Template by Colorlib
</p>
</div>
<div class="clearfix"></div>
</footer>
<!-- /footer content -->
</div>
<!-- /page content -->
</div>
</div>
<div id="custom_notifications" class="custom-notifications dsp_none">
<ul class="list-unstyled notifications clearfix" data-tabbed_notifications="notif-group"></ul>
<div class="clearfix"></div>
<div id="notif-group" class="tabbed_notifications"></div>
</div>
Using <footer> tag in HTML does not create a sticky bottom footer.
Have a look to this Bootstrap example

BEM - How to manage multiple nested class names

I have the following,
<header id="header">
<div class="header__top">
<div class="container">
<ul class="top-nav"><!-- new name -->
<li class="dropdown top-nav__profile">
Hi Mallinda!
<ul class="dropdown-menu">
<li>Profile</li>
<li class="top-nav__saved">Saved Searches</li>
<li class="top-nav__saved">Saved Agents</li>
<li class="top-nav__saved">Saved Listings</li>
<li>Email Preferences</li>
<li>Logout</li>
</ul>
</li>
<li class="top-nav__icon">
<i class="zmdi zmdi-notifications"></i>
</li>
<li class="pull-right top-nav__icon">
<i class="zmdi zmdi-facebook"></i>
</li>
<li class="pull-right top-nav__icon">
<i class="zmdi zmdi-twitter"></i>
</li>
<li class="pull-right top-nav__icon">
<i class="zmdi zmdi-google"></i>
</li>
</ul>
</div>
</div>
</header>
Since I have a lot of nested classes, I've decided to choose a new name 'top-nav' after certain level. Is it valid in BEM? or do I need to phrase block name 'header__' to every child element?
You may put blocks inside other blocks or elements. It is absolutely valid.

How to customize bootstrap sidebar/sidenav?

I need to make use of Twitter Bootstrap Sidebar for creating a menu in my web application.(Highlighted in red).
To create a menu as shown below.
The top item has a dropdown as shown in mage. And Next items in menu should come below this.But this is what I get when I use the css.
Menu Item overlaping the other.
Here is the bootstrap code:
<div class="span3 bs-docs-sidebar">
<ul class="nav nav-list bs-docs-sidenav affix">
<li class="active"><i class="icon-chevron-right"></i> Dropdowns</li>
<li class=""><i class="icon-chevron-right"></i> Button groups</li>
<li><i class="icon-chevron-right"></i> Button dropdowns</li>
<li><i class="icon-chevron-right"></i> Navs</li>
<li><i class="icon-chevron-right"></i> Navbar</li>
<li><i class="icon-chevron-right"></i> Breadcrumbs</li>
<li><i class="icon-chevron-right"></i> Pagination</li>
<li><i class="icon-chevron-right"></i> Labels and badges</li>
<li><i class="icon-chevron-right"></i> Typography</li>
<li><i class="icon-chevron-right"></i> Thumbnails</li>
<li><i class="icon-chevron-right"></i> Alerts</li>
<li><i class="icon-chevron-right"></i> Progress bars</li>
<li><i class="icon-chevron-right"></i> Media object</li>
<li><i class="icon-chevron-right"></i> Misc</li>
</ul>
</div>
Here is my code:
<div class="span3 bs-docs-sidebar">
<ul class="nav nav-list bs-docs-sidenav affix">
<li> <a class="dropdown-toggle" data-toggle="dropdown" href="#">
<i class="icon-user"></i>dany
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li><a id="logout" href="#">Sign Out</a></li>
</ul>
</li>
</ul>
</div>
<div class="span3 bs-docs-sidebar">
<ul class="nav nav-list bs-docs-sidenav `affix`">
<li></i>Approval Requests</li>
<li></i>Settings</li>
</ul>
</div>
The css class in bootstrap setting the position is bs-docs-sidenav and affix I belive.
The css of docs.css of twitter bootstrap is this
Anyone please help to solve this issue as soon as possible.
You are using span3 on both of your menus. That means the second menu will be placed on the next grid on the right, not below the first menu.
I believe you should start like this-
<div class="span3 bs-docs-sidebar">
<ul class="nav nav-list bs-docs-sidenav affix">
<li> <a class="dropdown-toggle" data-toggle="dropdown" href="#">
<i class="icon-user"></i>dany
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li><a id="logout" href="#">Sign Out</a></li>
</ul>
</li>
</ul>
<ul class="nav nav-list bs-docs-sidenav affix">
<li></i>Approval Requests</li>
<li></i>Settings</li>
</ul>
</div>
Now apply some CSS on the second menu e.g.
<ul class="nav nav-list bs-docs-sidenav affix" style="top: 200px;">
You have created two div of span3 bs-docs-sidebar and hence you are seeing sidebars in parallel. If you want menu 'dany' fixed on the top, then its better to put them on top bar using <div class="navbar navbar-inverse navbar-fixed-top">