html - Styling a table: how to add margin to one cell? -


consider this code:

html:

<table>     <tr>         <td>option 1</td>         <td><input type='checkbox' id='option1' /></td>     </tr>     <tr>         <td>option 2</td>         <td><input type='checkbox' id='option2' /></td>     </tr>     <tr>         <td>option 3</td>         <td><input type='checkbox' id='option3' /></td>     </tr>     <tr>         <td id='go' colspan=2>go</td>     </tr> </table> 

css:

td {     border: 1px solid black; } #go {     text-align: center;     cursor: pointer;     background: #aaa; } 

is possible set position of go cell 10px below current position ?

i tried play margin-top , cellspacing didn't help.

is possible ?

i don't believe can set margin on td element.

this nasty hack, insert row height="10px":

<tr>     <td>option 3</td>     <td><input type='checkbox' id='option3' /></td> </tr> <tr height="10px" /> <tr>     <td id='go' colspan=2>go</td> </tr> 

things why people shy away table layouts. anytime adding "invisible" tr's or td's affect layout of elements, start feel dirty.

the other option might work set #go padding "10px" button has 10px of padding on every side. using padding-top = 10px make button funny, b/c word go pushed down.

#go {     padding: 10px;     text-align: center;     cursor: pointer;     background: #aaa; } 

Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -