我试图在一些div中包装div(noint_box1)但是我没有成功。有人可以检查一下css,看看我做错了什么。
HTML:
<div id="tabs-container">
<div id="tabs-box">
<div class="tab active" id="tab1" onclick="showtab(1)">Delivery</div>
<div class="tab" id="tab2" onclick="showtab(2)">Payments</div>
<div class="tab" id="tab3" onclick="showtab(3)">Returns</div>
<div class="tab" id="tab4" onclick="showtab(4)">Discount</div>
</div>
<div id="tab-content-box">
<div class="tab-content active" id="content1">CONTENT </div>
<div class="tab-content" id="content2">CONTENT</div>
<div class="tab-content" style="text-decoration:none" id="content3">COTENT</div>
<div class="tab-content" id="content4">CONTENT</div>
</div>
</div>
</div>
样式表:
#noint_box1{text-align:center;}
#tabs-container { width:942px; border-color: transparent}
#tab-content-box { border:none; border-color: transparent }
#tabs-box { height: 30px; border-color: transparent; padding-bottom:3px;}
.header1 {font: 22px 'MuliLight', Arial, sans-serif; color: #026c9f; text-align:left; vertical-align:top; text-shadow: #6ac6f0 1px 1px 1px; font-weight:bold }
.tab {
font-family:Arial, Helvetica, sans-serif;
cursor:pointer
.tab.active { border-bottom: 2px solid white; text-align:left }
.tab.active { border-bottom: 2px solid white; text-align:left}
.tab-content { display: none; padding: 5px; text-align:left}
.tab-content.active { display: block; text-align:left}
#tab1 {margin-right:10px; text-align:center}
#tab2 {margin-right:10px; text-align:center}
#tab3 {margin-right:10px; text-align:center}
#tab4 {margin-right:10px; text-align:center}
#content1 {font: 16px 'MuliLight', Arial, sans-serif; text-align:left; color: #CCC; line-height:20px}
#content2 {font: 16px 'MuliLight', Arial, sans-serif; text-align:left; color: #CCC; line-height:20px; margin-bottom:3px}
#content3 {font: 16px 'MuliLight', Arial, sans-serif; text-align:left; color: #CCC; line-height:20px}
#content4 {font: 16px 'MuliLight', Arial, sans-serif; text-align:left; color: #CCC; line-height:20px}
答案 0 :(得分:2)
html和css都很臃肿,我不建议使用这样的风格
美化后两者
HTML via http://jsbeautifier.org/
<div id="noint_box1">
<td class="topparts" width="936">MY CONTENT1</td>
<div id="tabs-container">
<div id="tabs-box">
<div class="tab active" id="tab1" onclick="showtab(1)">Delivery</div>
<div class="tab" id="tab2" onclick="showtab(2)">Payments</div>
<div class="tab" id="tab3" onclick="showtab(3)">Returns</div>
<div class="tab" id="tab4" onclick="showtab(4)">Discount</div>
</div>
<div id="tab-content-box">
<div class="tab-content active" id="content1">CONTENT1
<br />
</div>
<div class="tab-content" id="content2">CONTENT2</div>
<div class="tab-content" style="text-decoration:none" id="content3">CONTENT3</div>
<div class="tab-content" id="content4">CONTENT4</div>
</div>
和CSS通过http://cssbeautify.com/
#noint_box1 {
text-align: center;
}
#tabs-container {
width: 942px;
border-color: transparent;
}
#tab-content-box {
border: none;
border-color: transparent;
}
#tabs-box {
height: 30px;
border-color: transparent;
padding-bottom: 3px;
}
.header1 {
font: 22px 'MuliLight', Arial, sans-serif;
color: #026c9f;
text-align: left;
vertical-align: top;
text-shadow: #6ac6f0 1px 1px 1px;
font-weight: bold;
}
.tab {
font-family: Arial, Helvetica, sans-serif;
cursor: pointer
.tab.active { border-bottom: 2px solid white;
text-align: left;
}
.tab.active {
border-bottom: 2px solid white;
text-align: left;
}
.tab-content {
display: none;
padding: 5px;
text-align: left;
}
.tab-content.active {
display: block;
text-align: left;
}
#tab1 {
margin-right: 10px;
text-align: center;
}
#tab2 {
margin-right: 10px;
text-align: center;
}
#tab3 {
margin-right: 10px;
text-align: center;
}
#tab4 {
margin-right: 10px;
text-align: center;
}
#content1 {
font: 16px 'MuliLight', Arial, sans-serif;
text-align: left;
color: #CCC;
line-height: 20px;
}
#content2 {
font: 16px 'MuliLight', Arial, sans-serif;
text-align: left;
color: #CCC;
line-height: 20px;
margin-bottom: 3px;
}
#content3 {
font: 16px 'MuliLight', Arial, sans-serif;
text-align: left;
color: #CCC;
line-height: 20px;
}
#content4 {
font: 16px 'MuliLight', Arial, sans-serif;
text-align: left;
color: #CCC;
line-height: 20px;
}
你可以很容易地发现HTML代码中的问题,而且css看起来过多,可能会被清理干净
答案 1 :(得分:1)
我发现HTML代码存在三个问题:
分区中有一个表格单元格。如果您在表格行中,则不能存在分区,如果您不在表格行中,则表格单元格不能存在。
<div id="tabs-container">
<div id="noint_box1">