jQuery UI & Tabs: Tabs at bottom

This entry is part 4 of 7 in the series jQuery UI Tabs

JS Bin

With some additional CSS (for positioning) and JS (to put the right classes on elements) the tabs can be placed below their content.

<!doctype html>
<html lang='en'>
    <meta charset='utf-8'>
    <title>jQuery UI Tabs - Tabs at bottom</title>
    <link rel='stylesheet' href='//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css'>
    <script src='//code.jquery.com/jquery-1.10.2.js'></script>
    <script src='//code.jquery.com/ui/1.10.4/jquery-ui.js'></script>
    <link rel='stylesheet' href='http://codecrawl.com/code/jqueryui/jqueryui_style.css'>
        $(function () {

            // fix the classes
            $('.tabs-bottom .ui-tabs-nav, .tabs-bottom .ui-tabs-nav > *')
                    .removeClass('ui-corner-all ui-corner-top')

            // move the nav to the bottom
            $('.tabs-bottom .ui-tabs-nav').appendTo('.tabs-bottom');
        /* force a height so the tabs don't jump as content height changes */
        #tabs .tabs-spacer {
            float: left;
            height: 100px;

        .tabs-bottom .ui-tabs-nav {
            clear: left;
            padding: 0 .2em .2em .2em;

        .tabs-bottom .ui-tabs-nav li {
            top: auto;
            bottom: 0;
            margin: 0 .2em 1px 0;
            border-bottom: auto;
            border-top: 0;

        .tabs-bottom .ui-tabs-nav li.ui-tabs-active {
            margin-top: -1px;
            padding-top: 1px;

<div id='tabs' class='tabs-bottom'>
        <li><a href='#tabs-1'>Pitbull</a></li>
        <li><a href='#tabs-2'>Sean Kingston</a></li>
        <li><a href='#tabs-3'>Taylor Swift</a></li>
    <div class='tabs-spacer'></div>
    <div id='tabs-1'>
        <p>Pitbull is a Cuban–American recording artist and Latin Grammy winning rapper from Miami, Florida.</p>
    <div id='tabs-2'>
        <p>Sean Kingston pursued a music career and debuted in 2007 with the album Sean Kingston.</p>
    <div id='tabs-3'>
        <p>Taylor Swift, raised in Wyomissing, Pennsylvania. She moved to Nashville, Tennessee at the age of

        <p>She is known for her narrative songs about her personal experiences.</p>

Try The Code
Series Navigation<< jQuery UI & Tabs: Collapsible content
jQuery UI & Tabs: Open on mouseover >>

Leave a comment

Leave a Reply