gpt4 book ai didi

html - 表格在 Chrome 中看起来不对,刷新后一切正常

转载 作者:行者123 更新时间:2023-11-28 06:17:41 25 4
gpt4 key购买 nike

我对表格有疑问。在 Firefox 上它看起来很棒,但是当我第一次在 Chrome 上打开它时,时间表处于不同的位置。刷新修复一切。我做错了什么?

CSS

    #spec0{
background-color: #FFFFFF;
width: 566px;
border: 1px solid #ddd;
}

#spec1{
background-color: #F1F1F1;
width: 566px;
height: 20px;
}

#table {
border-collapse: collapse;
width: 566px;
border: 1px solid #ddd;
margin-top: 11px;
position: static;
}

#tr{
border: 1px solid #ddd;
height: 10px;
font-size: 11pt;
text-align: right;
}


#tr1{
border: 1px solid #ddd;
height: 10px;
font-size: 11pt;
}

#tr3{
height: 10px;
font-size: 11pt;
border: 1px solid #ddd;
text-align: left;
}

HTML

<table id="table">
<tr id="spec">
<th id="tr">Template</th>
<th id="tr3">Template</th>
</tr>
<tr id="spec1">
<td id="tr">Template</td>
<td id="tr1">Template</td>
</tr>
<tr id="spec">
<td id="tr">Template</td>
<td id="tr1">Template</td>
</tr>
<tr id="spec1">
<td id="tr">Template</td>
<td id="tr1">Template</td>
</tr>
<tr id="spec">
<td id="tr">Template</td>
<td id="tr1">Template</td>
</tr>
<tr id="spec1">
<td id="tr">Template</td>
<td id="tr1">Template</td>
</tr>
<tr id="spec">
<td id="tr">Template</td>
<td id="tr1">Template</td>
</tr>
<tr id="spec1">
<td id="tr">Template</td>
<td id="tr1">Template</td>
</tr>
<tr id="spec">
<td id="tr">Template</td>
<td id="tr1">Template</td>
</tr>
<tr id="spec1">
<td id="tr">Template</td>
<td id="tr1">Template</td>
</tr>
<tr id="spec">
<td id="tr">Template</td>
<td id="tr1">Template</td>
</tr>
<tr id="spec1">
<td id="tr"></td>
<td id="tr1">Template</td>
</tr>
</table>

image; first launch from Chrome

最佳答案

您正在使用多个相同的 ID,ID 必须是唯一的,因此更改为类,并且您尝试应用 #spec0 而您只有 id="spec"

.spec {
background-color: #FFFFFF;
width: 566px;
border: 1px solid #ddd;
}
.spec1 {
background-color: #F1F1F1;
width: 566px;
height: 20px;
}
#table {
border-collapse: collapse;
width: 566px;
border: 1px solid #ddd;
margin-top: 11px;
position: static;
}
.tr {
border: 1px solid #ddd;
height: 10px;
font-size: 11pt;
text-align: right;
}
.tr1 {
border: 1px solid #ddd;
height: 10px;
font-size: 11pt;
}

.tr3 {
height: 10px;
font-size: 11pt;
border: 1px solid #ddd;
text-align: left;
}
<table id="table">
<tr class="spec">
<th class="tr">Template</th>
<th class="tr3">Template</th>
</tr>
<tr class="spec1">
<td class="tr">Template</td>
<td class="tr1">Template</td>
</tr>
<tr class="spec">
<td class="tr">Template</td>
<td class="tr1">Template</td>
</tr>
<tr class="spec1">
<td class="tr">Template</td>
<td class="tr1">Template</td>
</tr>
<tr class="spec">
<td class="tr">Template</td>
<td class="tr1">Template</td>
</tr>
<tr class="spec1">
<td class="tr">Template</td>
<td class="tr1">Template</td>
</tr>
<tr class="spec">
<td class="tr">Template</td>
<td class="tr1">Template</td>
</tr>
<tr class="spec1">
<td class="tr">Template</td>
<td class="tr1">Template</td>
</tr>
<tr class="spec">
<td class="tr">Template</td>
<td class="tr1">Template</td>
</tr>
<tr class="spec1">
<td class="tr">Template</td>
<td class="tr1">Template</td>
</tr>
<tr class="spec">
<td class="tr">Template</td>
<td class="tr1">Template</td>
</tr>
<tr class="spec1">
<td class="tr"></td>
<td class="tr1">Template</td>
</tr>
</table>

关于html - 表格在 Chrome 中看起来不对,刷新后一切正常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35800214/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com