html - Using margins vs absolute positioning when positioning elements? -


let's have simple table on site

<table class="table table-striped table-bordered">     <tr>         <th>name</th>         <th>version</th>         <th>edition</th>         <th>expire date</th>         <th>owner</th>     </tr>     <tr>         <td style="color:red;">homex</td>         <td>1.83</td>         <td>basic</td>         <td>13.07</td>         <td>all</td>     </tr> </table> 

and want move 20px top. should use margins

margin-top:20px; 

or better use absolute positioning

position:absolute; top:20px; 

which way better practice?

to answer question, let's consider there multiple tables similar 1 have 1 after other. in case of using position:absolute style along top wouldn't fulfill task. because in case have calculate manually how top px want each table, whereas if use margin-top style rule. work ease without manual calculation. hence both style rules different each other , used different reasons. hope understand.


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -