UI Patterns → Tabs

Tab Interface

Christopher Columbus

Christopher Columbus

Italian navigator, colonizer and explorer whose voyages led to general European awareness of the American continents.

Isaac Newton

Isaac Newton

English physicist, mathematician, astronomer, natural philosopher, alchemist, and theologian. His law of universal gravitation and three laws of motion laid the groundwork for classical mechanics.

Johannes Gutenberg

Johannes Gutenberg

German printer who invented the mechanical printing press.

Pattern and Usage

The tabbed functionality seen above is a key mechanism for organizing content. This approach is seen throughout the DotNetNuke administrative interface, and is intended to be used similarly in custom module development. However, this pattern can also be used just as easily outside of an administrative experience.

The tabs are implemented using JavaScript, more specifically a jQuery plugin. First you will organize your content into logical regions, and then it can be turned into tabs. View the markup, css, and jQuery above to see how it is done.

For more technical information, please visit the dnnTabs Wiki entry for this plugin.

AخA
 
1
<div class="dnnForm" id="tabs-demo">
2
    <ul class="dnnAdminTabNav">
3
        <li><a href="#ChristopherColumbus">Christopher Columbus</a></li>
4
        <li><a href="#IsaacNewton">Isaac Newton</a></li>
5
        <li><a href="#JohannesGutenberg">Johannes Gutenberg</a></li>
6
    </ul>
7
    <div id="ChristopherColumbus" class="dnnClear">
8
        <img src="<%=ResolveUrl("Images/498px-Christopher_Columbus.PNG") %>" alt="Christopher Columbus" width="32%" class="dnnLeft" />
9
        <div class="dnnRight" style="width:62%;margin-left:2%">
10
            <h1>Christopher Columbus</h1>
11
            <p>Italian navigator, colonizer and explorer whose voyages led to general European awareness of the American continents.</p>
12
        </div>
13
    </div>
14
    <div id="IsaacNewton" class="dnnClear">
15
        <img src="<%=ResolveUrl("Images/GodfreyKneller-IsaacNewton-1689.jpg") %>" alt="Isaac Newton" width="32%" class="dnnLeft" />
16
        <div class="dnnRight" style="width:62%;margin-left:2%">
17
            <h1>Isaac Newton</h1>
18
            <p>English physicist, mathematician, astronomer, natural philosopher, alchemist, and theologian. His law of universal gravitation and three laws of motion laid the groundwork for classical mechanics.</p>
19
        </div>
20
    </div>
21
    <div id="JohannesGutenberg" class="dnnClear">
22
        <img src="<%=ResolveUrl("Images/Gutenberg.jpg") %>" alt="Johannes Gutenberg" width="32%" class="dnnLeft" />
23
        <div class="dnnRight" style="width:62%;margin-left:2%">
24
            <h1>Johannes Gutenberg</h1>
25
            <p>German printer who invented the mechanical printing press.</p>
26
        </div>
27
    </div>
28
</div>
29
                                                

x
 
1
.dnnForm .ui-tabs {
2
    position: relative;
3
    padding: .2em;
4
    zoom: 1;
5
}
6
    /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
7
    .dnnForm .ui-tabs .ui-tabs-nav {
8
        margin: 0;
9
        padding: .2em .2em 0;
10
    }
11
12
        .dnnForm .ui-tabs .ui-tabs-nav li,
13
        ul.dnnAdminTabNav li {
14
            list-style: none;
15
            float: left;
16
            position: relative;
17
            top: 1px;
18
            margin: 0 .2em 1px 0;
19
            border-bottom: 0 !important;
20
            padding: 0;
21
            white-space: nowrap;
22
        }
23
24
            .dnnForm .ui-tabs .ui-tabs-nav li a,
25
            ul.dnnAdminTabNav li a {
26
                float: left;
27
                padding: .5em 1em;
28
                text-decoration: none;
29
                font-weight: bold;
30
                color: #fff;
31
                text-decoration: none;
32
                display: block;
33
                margin: 0;
34
                letter-spacing: -0.03em;
35
                background: #818181;
36
                background: -moz-linear-gradient(top, #818181 0%, #656565 100%);
37
                background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#818181), color-stop(100%,#656565));
38
                filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#818181', endColorstr='#656565',GradientType=0 );
39
                -moz-border-radius-topleft: 3px;
40
                -moz-border-radius-topright: 3px;
41
                -moz-border-radius-bottomright: 0px;
42
                -moz-border-radius-bottomleft: 0px;
43
                border-top-left-radius: 3px;
44
                border-top-right-radius: 3px;
45
                border-bottom-right-radius: 0px;
46
                border-bottom-left-radius: 0px;
47
                text-shadow: 0px 1px 1px #000;
48
            }
49
50
            .dnnForm .ui-tabs .ui-tabs-nav li.ui-tabs-selected {
51
                margin-bottom: 0;
52
                padding-bottom: 1px;
53
            }
54
55
                .dnnForm .ui-tabs .ui-tabs-nav li.ui-tabs-selected a,
56
                .dnnForm .ui-tabs .ui-tabs-nav li.ui-state-disabled a,
57
                .dnnForm .ui-tabs .ui-tabs-nav li.ui-state-processing a {
58
                    cursor: text;
59
                }
60
61
            .dnnForm .ui-tabs .ui-tabs-nav li a,
62
            .dnnForm .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a {
63
                cursor: pointer;
64
            }
65
    /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
66
    .dnnForm .ui-tabs .ui-tabs-panel {
67
        display: block;
68
        border-width: 0;
69
        padding: 1em 1.4em;
70
        background: none;
71
    }
72
73
.dnnForm .ui-tabs-panel {
74
    position: relative;
75
}
76
77
.dnnForm .ui-tabs-hide {
78
    display: none !important;
79
}
80
81
                                                

6
 
1
<script type="text/javascript">
2
    jQuery(function ($) {
3
        $('#tabs-demo').dnnTabs();
4
    });
5
</script>
6