views:

619

answers:

1

Hi all,

I am trying to replicate a page I have been given, and I have nearly finish, but I have a small problem with it.

The space between tr are too big. I have done it reducing the margin top and bottom but there is a point where rows overlap.

Does anybody have any suggestions?

Thanks.

e.g.

<style type="text/css">
.divContainer
{   
margin:10px;
background-color:#C7D8EE;
border:2px solid #0076BF;
text-align:left;    
}

.tableContainer
{
color:#0076BF;
margin: -10px 0px -10px 0px;
border-spacing: 10px;
empty-cells:show;
width:90%;

}   
.tableContainer tr td{
 white-space:nowrap;
}

.tableContainerRow2{
background-color:white;
border:2px solid #0076BF;

}
</style>
  <div class="divContainer">
      <table class="tableContainer" cellspacing="10px">
          <tr>
              <td>NHS Number</td>
              <td>&#160;</td>
              <td>Date of Visit</td>
              <td>&#160;</td>
              <td colspan="3">Care Time Started</td>
              <td>&#160;</td>
              <td>&#160;</td>
              <td rowspan="2" style="font-weight:bold;vertical-align:middle;">Tick when<br/> care starts</td>
          </tr>
           <tr >
              <td width="90" class="tableContainerRow2">&#160;0123456789</td>
              <td >&#160;</td>
              <td width="80" class="tableContainerRow2">&#160;12/12/09</td>
              <td >&#160;</td>
              <td width="40" class="tableContainerRow2">&#160;12</td>
              <td  width="5">:</td>
              <td width="40" class="tableContainerRow2">&#160;10</td>                         
              <td >&#160;</td>
              <td style="text-align:right" >&#160;&#9745;</td>
          </tr>
      </table>
      <table class="tableContainer" cellspacing="10px" >
          <tr>
              <td></td>
              <td>Initials</td>
              <td>Surname</td>
          </tr>
          <tr>
              <td width="80" style="font-weight:bold;">Midwife</td>
              <td width="50" class="tableContainerRow2">&#160;</td>
              <td class="tableContainerRow2">&#160;</td>
          </tr>
          <tr>
              <td></td>
              <td>Initials</td>
              <td>Surname</td>
          </tr>
          <tr>
              <td style="font-weight:bold;">Doctor</td>
              <td class="tableContainerRow2">&#160;</td>
              <td class="tableContainerRow2">&#160;</td>
          </tr>
      </table>
      <table class="tableContainer" cellspacing="10px" >
          <tr>
             <td width="250">Forename</td>
             <td>Surname</td>
         </tr>
          <tr>
             <td class="tableContainerRow2">&#160;</td>
             <td class="tableContainerRow2">&#160;</td>
        </tr>
     </table>
     <table class="tableContainer" cellspacing="10px" >
        <tr>
          <td width="90">Date of Birth</td>
          <td width="150"></td>
          <td width="100">Casenote No:</td>
          <td></td>
      </tr>
      <tr>
          <td class="tableContainerRow2">&#160;</td>
          <td></td>
          <td class="tableContainerRow2">&#160;</td>
          <td></td>
          </tr>
    </table>
 </div>
+2  A: 

Remove cellspacing="10px" from the <table> and use CSS only. You already have definied it with border-spacing: 10px;.

BalusC
Hi, thanks for the advise, I wanted to clarify the reason I am defining twice is because IE apparently does not support border-spacing (I was told), so I had to add cellspacing to make it cross browser compatible. Correct me if I am wrong.
Cesar Lopez
Instead of `border-spacing` you can also just use an invisible `border` on `td` elements **and** `border-collapse: collapse` on the `table` element.
BalusC