Search code examples
jquerycssjquery-tabs

Blank space at the bottom of JQuery tabs


I am using JQuery tabs in my page, and have successfully managed to place the tabs below the content using some borrowed CSS settings/script.

My page has a side bar on the left side, and a menu banner at the top of the page. The content then appears between the top menu banner and the tabs panel at the bottom.

I noticed there is a small blank space at the bottom of my page whichs results in the vertical scrollbar showing. I would like to remove this space (and the scrolling) and need some help from an expert.

I know the space is caused by the tabs section of my content because I have used firebug and elimination techniques on other major elements and the space only appears when I introduce the tabs.

I have set the CSS padding, margins, and border-width to zero but still see the space.

Here is my HTML, CSS, and script:

<head>
    <title>Rfq</title>
    <%= stylesheet_link_tag "rfq.css" %>
    <%= javascript_include_tag :defaults %>
    <%= javascript_include_tag "jquery-ui-1.8.10.custom.min.js" %>
    <%= javascript_include_tag "rfq.js" %>
    <%= csrf_meta_tag %>
</head>
<body>
  <!--the top menu bar-->
  <div id="rfq_menu_bar" class="ui-widget-header">Request for quote...</div>
  <!--the side bar collapsed-->
  <div id="rfq_side_bar_collapsed" class="ui-tabs-nav ui-state-active" >
  </div>
    <!--the tab panels-->
  <div id=rfq_tabs_parent class="ui-widget-content">
      <div id="rfq_main_tabs" class="tabs-bottom ui-widget-content">
        <ul>
          <li><a class="rfq_main_tab" id="items_tab" href="#rfq_items_panel">RFQ Items</a></li>
          <li><a class="rfq_main_tab" id="reports_tab" href="#rfq_reports_panel">RFQ Reports</a></li>
        </ul>
          <div class="rfq_tab_content" id="rfq_items_panel">bob</div>
          <div class="rfq_tab_content" id="rfq_reports_panel">jane</div>
      </div>
  </div>
</body>

And my CSS:

html, body {
margin: 0;
padding: 0;
height: 100%;
font-family: Verdana, Sans-serif;
font-size: 10px;
position: relative;
border-width:0;
}

#rfq_users_table_wrapper {
width: 100%;
left:0;
top:0;
position: absolute;
margin: 0;
padding: 0;
}

#rfq_menu_bar {
margin: 0;
padding: 0;
height: 8%;
font-family: Sans-serif;
font-size: 20px;
left:0;
width:100%;
border-width:0;
}

#rfq_side_bar_collapsed {
margin: 0;
padding: 0;
float: left;
height:92%;
width:2%;
border-width:0;
}

#rfq_main_tabs {
height:100% !important;
padding: 0;
margin:  0;
border-width: 0;
}


.ui-button-text
{
font-size: 10px;
}

#rfq_tabs_parent {
position:absolute;
left:2%;
width:98%;  !important;
height: 92% !important;
z-index: -2000;
margin: 0;
padding: 0;
border-width:0;
}

#rfq_items_panel {
padding: 0;
margin:  0;
border-width:0;
}

#rfq_reports_panel {
padding: 0;
margin:  0;
border-width: 0;
}

.rfq_tab_content {
height:100% !important;
width:100% !important;
padding: 0;
margin:  0;
}

.tabs-bottom {
position: relative;
padding: 0;
margin:  0;
}

.tabs-bottom .ui-tabs-panel {
height: 120px;
overflow: auto;
}

.tabs-bottom .ui-tabs-nav {
position: absolute !important;
left: 0;
bottom: 0;
right:0;
padding: 0 0.2em 0.2em 0;
}

.tabs-bottom .ui-tabs-nav li {
margin-top: -1px !important;
margin-bottom: 3px !important;
border-top: none;
border-bottom-width: 1px;
}

.ui-tabs-selected {
margin-top: -3px !important;
}

My Javascript:

// Positions tabs at the bottom of the content:

$( ".tabs-bottom .ui-tabs-nav, .tabs-bottom .ui-tabs-nav > *" )
    .removeClass( "ui-corner-all ui-corner-top" )
    .addClass( "ui-corner-bottom" );

Solution

  • I understand this is not an answer per say, rather a pain killer, but here you go. Add this to your styles:

    .ui-helper-clearfix::after {
        display: inline !important;
    }​
    

    Patched fiddle - http://jsfiddle.net/uTatW/

    Looks to be a problem with the clearfixes the tabs plug-in itself applies to its DOM nodes. Overriding the display: block it inherits from the styles removes this trouble seemingly without hurting anything.