Terlihat bahwa ada 2 elemen penting di atas yaitu tabs, elemen yang Anda klik dan kontainer, area isi konten.

CSS:
body{
    text-decoration: none;
    color: black;
    font-size: 14px;
    font-family: arial;
}

.panes div {
    display:none;       
    padding:15px 10px;
    border:1px solid #999;
    border-top:0;
    height:100px;
    font-size:14px;
    background-color:#fff;
}

/* root element for tabs  */
ul.tabs {
    list-style:none;
    margin:0 !important;
    padding:0;   
    border-bottom:1px solid #666;   
    height:30px;       
}

/* single tab */
ul.tabs li {   
    float:left;     
    text-indent:0;
    padding:0;
    margin:0 !important;
    list-style-image:none !important;
    color: black;
    text-decoration: none;    
}

/* link inside the tab. uses a background image */

ul.tabs a {
    background-image: url(blue.png);
    display:block;
    height: 30px;
    line-height:30px;
    width: 134px;
    text-align:center;
    text-decoration:none;
    color:#333;
    padding:0px;
    margin:0px;
    position:relative;
    top:1px;
    background-repeat: no-repeat;
    background-position: -420px 0px;
}

ul.tabs a:active {
    outline:none;       
}

/* when mouse enters the tab move the background image */

ul.tabs a:hover {
    background-position: -420px -31px;   
    color:#fff;   
}

/* active tab uses a class name “current”. its highlight is also done by moving the background image. */
ul.tabs a.current, ul.tabs a.current:hover, ul.tabs li.current a {
    background-position: -420px -62px;       
    cursor:default !important;
    color:#33a9ed !important;
}

/* initially all panes are hidden */
.panes .pane {
    display:none;           
}

.panes div span{
    font-size: 24px;
    color: blue;
}

HTML:
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
    <meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
    <title>Tabs sederhana dengan css</title>

    <!– include the JQUERY Tools –>
    <script src=”jquery.tools.min.js”></script>

    <!– tab styling –>
    <link rel=”stylesheet” type=”text/css” href=”tabs.css” />

<!– he role of JavaScript is to “bind tabs to panes” and enable the tabbing effect. –>   
<script>
$(function() {
    $(“ul.tabs”).tabs(“div.panes > div”);
});
</script>   
   
</head>
<body>

<!– the tabs –>
<ul class=”tabs”>
    <li><a href=”#”>Tab 1</a></li>
    <li><a href=”#”>Tab 2</a></li>
    <li><a href=”#”>Tab 3</a></li>
</ul>

<!– tab “panes” –>
<div class=”panes”>
    <div>First tab content.<br /><br />
<span>You can design your working content with text or image.</span>
    </div>
    <div>Second tab content</div>
    <div>Third tab content</div>
</div>

</body>
</html>

DEMO:

Kunjungi www.proweb.co.id untuk menambah wawasan anda.

Tabs sederhana dengan css