<h2>...and I was all,</h2>
<h1>"Tabs to the left of me,<br />
tabs to the right!"</h1>
<div class="tab-body-container ">
<ul class="tab-group">
<li id='tab-1' class='tab-current'>Tab 1</li>
<li id='tab-2'>Tab 2</li>
<li id='tab-3'>Tab 3</li>
</ul>
<ul class="body-group">
<li id='body-1'>
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren</p>
<p>No sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo
dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed
diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p>
</li>
<li id='body-2'>
<p>Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te
feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p>
</li>
<li id='body-3'>
<p>Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat
nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.</p>
</li>
</ul>
</div>
<div class="tab-body-container tab-body-container-secondary">
<ul class="tab-group">
<li id='tab-1' class='tab-current'>Tab 1</li>
<li id='tab-2'>Tab 2</li>
<li id='tab-3'>Tab 3</li>
</ul>
<ul class="body-group">
<li id='body-1'>
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea
takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores
et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p>
</li>
<li id='body-2'>
<p>Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te
feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p>
</li>
<li id='body-3'>
<p>Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat
nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.</p>
</li>
</ul>
</div>
body {
background: #3f3f3f;
width: 90%;
margin: 20px auto;
font-family: helvetica, sans-serif;
}
p {
margin: 10px 0px;
}
h1 {
color: #b4c4d4;
margin: 0px 0px -30px;
}
h2 {
color: #808285;
margin: 0px;
}
/* ==TABS TO THE RIGHT OF ME== */
.tab-body-container {
position: relative;
margin: 0px;
padding: 0px;
}
.tab-group {
list-style: none;
height: 34px;
margin-bottom: 0px !important;
position: relative;
right: 0;
}
.tab-group li {
float: right;
display: inline-block;
padding: 8px 16px;
color: #FFF;
cursor: pointer;
background: #808285;
margin-right: 0px;
border-right: 1px solid #c0c3c8;
}
.tab-current {
background: #3e7898 !important;
}
.tab-group li:first-child {
border-right: 0px !important;
}
.body-group {
background: #FFF;
margin: 0px;
padding: 0px;
}
.body-group li {
list-style: none;
display: none;
position: relative;
padding: 15px;
}
/* ==TABS TO THE LEFT OF ME== */
.tab-body-container-secondary .tab-group {
padding: 0px;
}
.tab-body-container-secondary .tab-group li {
float: left;
background: #b4c4d4;
border-right: 1px solid #dde8f3;
}
.tab-body-container-secondary .tab-group li:first-child {
border-right: 1px solid #dde8f3 !important;
}
.tab-body-container-secondary .tab-group li:last-child {
border-right: 0px !important;
}
.tab-body-container-secondary .body-group {
background: #e7e8e9 !important;
}
.white-bgk {
background: #FFF;
margin: -15px -15px;
padding: 10px 4px;
}
//This is a very simple tab group jQuery function I wrote for a site.
//vistit http://megadalbey.com for more fun stuff.
jQuery(".tab-body-container").each(function(i, e) { //get all tab group containers
t = getUrlVars()["t"]; //this bit only works if you're using it in a browser window and you pre-select a tab by adding (for example) ?t=1 for first tab to URL string.
if (t) {
jQuery(e).find(".tab-group").children().removeClass("tab-current");
c = jQuery(e).find(".tab-group li#tab-" + t);
c.addClass("tab-current");
} else {
c = jQuery(e).find(".tab-group li.tab-current"); //get the current tab
}
if (c.length == 0) { //if there isn't a current tab, get the first tab.
c = jQuery(e).find(".tab-group").children().first();
c.addClass("tab-current");
}
setTabBody(c);
});
jQuery(".tab-group li").click(function() { //when a tab is clicked, set to that tab.
setTabBody(jQuery(this));
});
function setTabBody(c) {
d = c.parent().parent(); //tab body container
tID = jQuery(c).attr("id").split("-"); //tabID
d.find(".body-group").children().hide(); //hide all tab bodies
if (!c.hasClass("tab-current")) { //if clicked tab isn't set to current...
c.parent().children().removeClass('tab-current'); //remove all current tab classes
c.addClass('tab-current'); //make clicked tab the current tab
}
if (!d.find(".body-group li#body-" + tID[1]).is(":visible")) { //if clicked tab bodyID isn't visible...
d.find(".body-group").children().hide(); //hide all tab bodies
d.find(".body-group li#body-" + tID[1] + ", .body-group li#body-" + tID[1] + " li").show(); //show clicked tab body and any other li inside of body.
}
}
function getUrlVars() { //this function parses out GET vars from URL
var vars = {};
var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m, key, value) {
vars[key] = value;
});
return vars;
}
This Pen doesn't use any external CSS resources.