Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS margin inside table

Tags:

css

margin

I'm trying with no luck apply right margins inside tables

<html>
  <style>
    input,select {
      width: 100%;
      margin-right: 15px;
      background: red;
    }
  </style>
  <body>
    <table border="2" color="red" width="100%">
       <tr>
         <td width="25%"><input type="text" /></td>
         <td width="25%"><select><option>foobar</option></select></td>
         <td width="25%"><input type="text" /></td>
         <td width="25%"><input type="text" /></td>
       </tr>
       <tr>
         <td width="25%"><input type="text" /></td>
         <td width="25%"><input type="text" /></td>
         <td width="25%"><select><option>foobar</option></select></td>
         <td width="25%"><input type="text" /></td>
       </tr>
    <table>
  </body>
</html>

Example: http://jsfiddle.net/3reat/

Only using CSS it's possible to define this margins 100% - 15px?

http://jsfiddle.net/3reat/2/

like image 445
Ragen Dazs Avatar asked Apr 13 '13 16:04

Ragen Dazs


1 Answers

try css3 calc

(e.g)

margin: calc(100% - 15px);
margin: -webkit-calc(100% - 15px);
margin: -moz-calc(100% - 15px);

Reference : https://developer.mozilla.org/en-US/docs/CSS/calc

like image 88
Tamil Selvan C Avatar answered Oct 21 '22 19:10

Tamil Selvan C