Search code examples
htmlcsscss-tables

How to get an HTML table to be exactly 36 pixels from the right window edge


This doesn't appear to possible either with or without CSS - I want a table that's exactly 36px from both the left and right sides of the browser window. I can easily get the left margin set - but it doesn't appear to be possible to get the right margin to be exact (margin-right css seems to be totally ignored, and exacerbated by margin-left settings).

Neither percentages nor fixed width work well for my scenario.

Am I missing something?


Solution

  • div.tablecontainer {
      padding: 36px;
    }
    .tablecontainer table {
      width: 100%;
    }
    
    <div class="tablecontainer">
      <table>....</table>
    </div>
    

    http://jsfiddle.net/GolezTrol/3UBK3/