我每周都有HTML报告,两个部分并排。 tr
中的一个部分在其上方有一个标题,第2部分有一个类似的标题。我写了一个简单的tr
th
来显示标题。但现在我想在此表格上方放置一个标题。我写了一个div
来显示这样的标题:
<div style="float:right;width:70%; font-weight: bold">
Weekly Recordable Incident Rate
Weekly Lost Time Incident Rate
</div>.
但这会影响分辨率。当您最小化浏览器时,标题会左右移动。
有人可以帮助我吗?
<table cellpadding="0" cellspacing="0" width="100%">
<div style="float:right;width:70%; font-weight: bold">
Weekly Recordable Incident Rate Weekly Lost Time Incident Rate
</div>
<tr>
<th><span style='color:white;margin-right:1.00cm;'> </span></th>
<th colspan="2" class="bluebg">Wk1 </th>
<th colspan="2" class="bluebg">Wk2 </th>
<th colspan="2" class="bluebg">Wk3 </th>
<th colspan="2" class="bluebg">Wk4 </th>
<th colspan="2" class="bluebg">Wk5 </th>
<th class="whitebg"> </th>
<th class="bluebg">Wk2 </th>
<th class="bluebg">Wk3 </th>
<th class="bluebg">Wk4 </th>
<th class="bluebg">Wk5 </th>
<th class="bluebg">Wk6 </th>
</tr>
<tr>
<th><span style='color:white;margin-right:2.00cm;'> </span></th>
<td style="border-bottom-color: white;">Recs</td>
<td style="border-bottom-color: white;">RIR</td>
<td style="border-bottom-color: white;">Recs</td>
<td style="border-bottom-color: white;">RIR</td>
<td style="border-bottom-color: white;">Recs</td>
<td style="border-bottom-color: white;">RIR</td>
<td style="border-bottom-color: white;">Recs</td>
<td style="border-bottom-color: white;">RIR</td>
<td style="border-bottom-color: white;">Recs</td>
<td style="border-bottom-color: white;">RIR</td>
</tr>
</table>
答案 0 :(得分:1)
<table border="1">
<tr height="20px;"> <td colspan="17"><div style="width:100%; font-weight: bold">
<div style="float: right;margin: 0 auto;width: 44%; ">Weekly Recordable Incident Rate</div><div style="float: right;
margin: 0 auto;width: 44%;">Weekly Lost Time Incident Rate</div><div style="clear:both;"></div>
</div> </td></tr>
<tr>
<th><span style="color:white;margin-right:1.00cm;width:10px;"> </span></th>
<th colspan="2" class="bluebg">Wk1 </th>
<th colspan="2" class="bluebg">Wk2 </th>
<th colspan="2" class="bluebg">Wk3 </th>
<th colspan="2" class="bluebg">Wk4 </th>
<th colspan="2" class="bluebg">Wk5 </th>
<th class="whitebg"> </th>
<th class="bluebg">Wk2 </th>
<th class="bluebg">Wk3 </th>
<th class="bluebg">Wk4 </th>
<th class="bluebg">Wk5 </th>
<th class="bluebg">Wk6 </th>
</tr>
<tr>
<th><span style="color:white;margin-right:2.00cm;"> </span> </th>
<td style="border-bottom-color: white;">Recs</td>
<td style="border-bottom-color: white;">RIR</td>
<td style="border-bottom-color: white;">Recs</td>
<td style="border-bottom-color: white;">RIR</td>
<td style="border-bottom-color: white;">Recs</td>
<td style="border-bottom-color: white;">RIR</td>
<td style="border-bottom-color: white;">Recs</td>
<td style="border-bottom-color: white;">RIR</td>
<td style="border-bottom-color: white;">Recs</td>
<td style="border-bottom-color: white;">RIR</td>
</tr>
</table>
抱歉,因为我只是打算,但我希望通过这个你得到提示,以获得你想要的解决方案
答案 1 :(得分:0)
Avinafh:当div的宽度分别设置为60和44时
答案 2 :(得分:0)
这就是我要做的。
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
<th></th>
<th colspan="10" style="text-align:center">Weekly Recordable Incident Rate</th>
<th></th>
<th colspan="5" style="text-align:center">Weekly Lost Time Incident Rate</th>
</tr>
<tr>
<th><span style='color:white;margin-right:1.00cm;'> </span></th>
<th colspan="2" class="bluebg">Wk1</th>
<th colspan="2" class="bluebg">Wk2</th>
<th colspan="2" class="bluebg">Wk3</th>
<th colspan="2" class="bluebg">Wk4</th>
<th colspan="2" class="bluebg">Wk5</th>
<th class="whitebg"> </th>
<th class="bluebg">Wk2</th>
<th class="bluebg">Wk3</th>
<th class="bluebg">Wk4</th>
<th class="bluebg">Wk5</th>
<th class="bluebg">Wk6</th>
</tr>
<tr>
<th><span style='color:white;margin-right:2.00cm;'> </span></th>
<td style="border-bottom-color: white;">Recs</td>
<td style="border-bottom-color: white;">RIR</td>
<td style="border-bottom-color: white;">Recs</td>
<td style="border-bottom-color: white;">RIR</td>
<td style="border-bottom-color: white;">Recs</td>
<td style="border-bottom-color: white;">RIR</td>
<td style="border-bottom-color: white;">Recs</td>
<td style="border-bottom-color: white;">RIR</td>
<td style="border-bottom-color: white;">Recs</td>
<td style="border-bottom-color: white;">RIR</td>
</tr>
</table>