views:

23

answers:

2

I have a div in the html and after the Div and i have another div which contains the HTml table Which is coming on the top of div .How to bring the table down .

<div id='testupdate2' >Mynumber: ". $num." </div>
<div id="test">
  <table cellspacing=0 cellpadding=0 border=0 width="100%">
      <tbody>
        <tr>
          <td id="Header" class="navUPD">MY number</td>
        </tr>
        <tr>
          <td id="tls" class="navUPD">MY DETAILS </td>
        </tr>
        <tr>
          <td id="mgmnt" class="navOFFTDUPD"> ADDR. MGMT </td>
        </tr>            
   </tbody>
  </table>  
</div>

How to bring the table down to the DIV

+1  A: 

To push your table off the top of your <div id="test"> you can use CSS padding:

#test {
    padding-top: 20px;
}

Or alternatively:

#test table {
    padding-top: 20px;
}
Pat
Padding sometimes doesn't work good in all browsers. I would rather use `margin-top` than `padding-top`.
Ventus
@Ventus: By all means, use whichever gets the job done for you. I prefer padding because it doesn't rely on the elements above to create the spacing.
Pat
Actually, you'd want either padding-top on the div to push the contents down from the border or margin-top on the table to push it down from the div... but yes, this.
ANeves
A: 

If you have something else in <div id="test"> except that table and you want to table be always aligned to bottom of the div, you can do something like this in your CSS


#id{
  position: relative;
}
#id table{
  position: absolute; /*this is absolute to #id not to body tag*/
  bottom: 0px;
  left: 0px;
}

This should do the job, I think (I didn't check it).

Ventus
-1: not OP's answer, and hack-ish. OP just wants the table to be separated from the top a bit.
ANeves
sorry, seems I didn't understand fully his question
Ventus
That's quite allright. If you're good-willed you'll get plenty more positive feedback than negative, and positive is worth much more.The question wasn't that clear either... heh.
ANeves