在桌子上方的标题不符合分辨率

时间:2014-04-22 06:45:00

标签: html css

我每周都有HTML报告,两个部分并排。 tr中的一个部分在其上方有一个标题,第2部分有一个类似的标题。我写了一个简单的tr th来显示标题。但现在我想在此表格上方放置一个标题。我写了一个div来显示这样的标题:

<div style="float:right;width:70%; font-weight: bold">
  Weekly Recordable Incident Rate&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  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&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;    Weekly Lost Time Incident Rate
       </div>   

       <tr>
          <th><span style='color:white;margin-right:1.00cm;'>&nbsp;</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">&nbsp;</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;'>&nbsp;</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>

This is good when browser is full opened

This is the problem, when maximize the browser heading get distracted

3 个答案:

答案 0 :(得分:1)

你给我们所有的css所以我完整地完成它但是请检查这一个..可能它会帮助

<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;">&nbsp;</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">&nbsp;</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;">&nbsp;</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时Like this

答案 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;'>&nbsp;</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">&nbsp;</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;'>&nbsp;</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>