我想在 HTML 中创建一个选项卡式视图。我的问题是其中一个选项卡中有选项卡。我的问题是我不知道如何确保子选项卡不显示,除非我在配置文件选项卡中。实现这一目标的最佳方法是什么?如何使用 javascript 相应地更新类而不显示选项卡?任何帮助将不胜感激。我的代码是
<div class="tabheader">
<ul>
<li><a href="#addprop_tab" title="">Add Property</a></li>
<li><a href="#savedprop_tab" title="">Saved Property</a></li>
<li><a href="#inbox_tab" title="">Inbox</a></li>
<li><a href="#profile_tab" title="">Update Profile</a></li>
</ul>
</div> <!-- End of tabheader -->
<div class="tabcontent">
<div id="addprop_tab">
<p><a href="#" title="Click to add property">Add your property to NPLH</a></p>
show added property
</div> <!-- End of addprop_tab -->
<div id="savedprop_tab">
<p>Browse your saved properties</p>
</div> <!-- End of savedprop_tab -->
<div id="inbox_tab">
<p>inbox</p>
</div> <!-- End of inbox_tab -->
<div id="profile_tab">
<ul>
<a href="#tab1" title="">Tab1</a>
<a href="#tab2" title="">Tab2</a>
<a href="#tab3" title="">Tab3</a>
</ul>
</div> <!-- End of profile_tab -->
</div> <!-- End of tabcontent -->
<div class="subtab_content">
<div id="tab1">
<p>tab1</p>
</div> <!-- End of tab1 -->
<div id="tab2">
<p>tab2</p>
</div> <!-- End of tab2 -->
<div id="tab3">
<p>tab3</p>
</div> <!-- End of tab3 -->
</div>
CSS代码是
.tabheader {
width: 1000px;
position: relative;
top: -100px;
}
.tabheader ul {
list-style-type: none;
}
.tabheader ul li {
float: left;
width: 175px;
font-size: 15px;
text-align: center;
padding: 10px 25px 10px 25px;
margin: 0px 11px 5px 11px;
border: 1px solid #aaa;
}
.tabcontent {
clear: both;
position: relative;
top: -100px;
height: 40px;
overflow: hidden;
background: #eee;
}
.tabcontent div {
height: 40px;
padding: 10px;
}
.subtab_content {
clear: both;
position: relative;
top: -100px;
height: 200px;
overflow: hidden;
background: #eee;
}
.subtab_content div {
height: 200px;
padding: 10px;
}