Back to CSS Tips
Preview: what the working site looks like.
subdiv1 subdiv2 subdiv3 subdiv4
subdiv1
subdiv2
subdiv3
subdiv4
The markup
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
</head>
<body>      
    <div id="container">
        <a href="javascript:void(0)" id="one" onclick="ShiftTo('subdiv1')" style="color: #f00">subdiv1</a>
        <a href="javascript:void(0)" id="two" onclick="ShiftTo('subdiv2')" style="color: #00f">subdiv2</a>
        <a href="javascript:void(0)" id="three" onclick="ShiftTo('subdiv3')" style="color: #0F0">subdiv3</a>
        <a href="javascript:void(0)" id="four" onclick="ShiftTo('subdiv4')" style="color: #000">subdiv4</a>
            <div id="popped">
                <div id="subdiv1">subdiv1</div>
                <div id="subdiv2">subdiv2</div>
                <div id="subdiv3">subdiv3</div>
                <div id="subdiv4">subdiv4</div>
        <!--end popped--></div>
    <!--container--></div>
</body>
</html>
        
The CSS
html, body {
	margin: 0;
	font: 100% "Trebuchet MS", Arial, Helvetica, sans-serif;
	color: #000;
	background: #fc6;
}		
#container {
	width: 800px;
	margin: 30px auto;
	background: #999;
	overflow: auto;
	font-size: 0.8em;
}
#one, #two, #three, #four {
	line-height: 30px;
	padding: 5px 10px;
	background: #ffc;
}
	#one:hover, #two:hover, #three:hover, #four:hover {background: #fff;}
		#subdiv1, #subdiv2, #subdiv3, #subdiv4 {
			height: 100px;
			padding: 90px 0 0;
			display: none;
			text-align: center;
		}
			#subdiv1 {
				display: block;
				background:#f00;
			}
			#subdiv2 {background: #00f;}
			#subdiv3 {background: #0f0;}
			#subdiv4 {
				color: #fff;
				background: #000;
			}
#popped {background: #ccc;}
		
The jQuery/JavaScript
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script type="text/javascript">
	function ShiftTo(DivID){
	  Base=document.getElementById(DivID).parentNode;
	  Sub=Base.getElementsByTagName('div');
	  for (x=0;x<Sub.length;x++){
		if (Sub[x].parentNode==Base){
		  if (Sub[x].id==DivID){
			Sub[x].style.display="block";
		  }else{
			Sub[x].style.display="none";
		  }
		}
	  }
	}
</script>