title: Responsive table renders perfectly in everything but default iOS 7 mail app
body: <p>The default iOS 7 (iOS 7.1.1) mail app won't render this table correctly. Chrome, Firefox, and Safari (most recent versions) all render the desktop view and the mobile view perfectly. Internet Explorer renders the desktop view correctly but not the mobile view (which is fine). iOS Safari renders the mobile view perfectly.  <a href="http://jsfiddle.net/wAhJY/" rel="nofollow noreferrer">Here is a JSFiddle</a> which shows it working properly when you resize it. <a href="https://i.imgur.com/nX61XPf.png" rel="nofollow noreferrer">Here is a screenshot</a> of how it renders in iOS Mail.</p>
  
  <h1>HTML</h1>
  
  <pre><code>&lt;div id="responsive-table"&gt;
  &lt;table class="body-copy" style="font-size:14px; color:#666666; font-weight:normal; font-family: HelveticaNeue, sans-serif; line-height: 130%;"&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Item #&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Qty&lt;/th&gt;
              &lt;th&gt;Price&lt;/th&gt;
              &lt;th&gt;Total&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;#####1&lt;/td&gt;
              &lt;td&gt;Item Description goes here I&lt;/td&gt;
              &lt;td&gt;1&lt;/td&gt;
              &lt;td&gt;$9.49&lt;/td&gt;
              &lt;td&gt;$9.49&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;#####2&lt;/td&gt;
              &lt;td&gt;Item Description goes here II&lt;/td&gt;
              &lt;td&gt;2&lt;/td&gt;
              &lt;td&gt;$9.99&lt;/td&gt;
              &lt;td&gt;$19.98&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;#####3&lt;/td&gt;
              &lt;td&gt;Item Description goes here III&lt;/td&gt;
              &lt;td&gt;4&lt;/td&gt;
              &lt;td&gt;$3.79&lt;/td&gt;
              &lt;td&gt;$15.16&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;#####4&lt;/td&gt;
              &lt;td&gt;Item Description goes here IV&lt;/td&gt;
              &lt;td&gt;1&lt;/td&gt;
              &lt;td&gt;$17.94&lt;/td&gt;
              &lt;td&gt;$17.94&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;#####5&lt;/td&gt;
              &lt;td&gt;Item Description goes here V&lt;/td&gt;
              &lt;td&gt;3&lt;/td&gt;
              &lt;td&gt;$4.99&lt;/td&gt;
              &lt;td&gt;$14.97&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
  &lt;/table&gt;
  &lt;/div&gt;
  </code></pre>
  
  <h1>CSS</h1>
  
  <pre><code>@media screen and (max-width: 480px) {
  /* Force table to not be like tables anymore */
  #responsive-table table, thead, tbody, th, td, tr {
      display: block;
  }
  /* Hide table headers (but not display: none;, for accessibility) */
  #responsive-table thead tr {
      position: absolute;
      top: -9999px;
      left: -9999px;
  }
  #responsive-table tr {
      border: 1px solid #ccc;
      margin-bottom: 25px;
  }
  #responsive-table td {
      /* Behave  like a "row" */
      border: none;
      border-bottom: 1px solid #eee;
      position: relative;
      padding-left: 42% !important;
  }
  #responsive-table td:before {
      position: absolute;
      /* Top/left values mimic padding */
      top: 6px;
      left: 6px;
      width: 45%;
      padding-right: 10px;
  }
  #responsive-table td:nth-of-type(1):before {
      content:"Item #";
  }
  #responsive-table td:nth-of-type(2):before {
      content:"Description";
  }
  #responsive-table td:nth-of-type(3):before {
      content:"Quantity";
  }
  #responsive-table td:nth-of-type(4):before {
      content:"Price";
  }
  #responsive-table td:nth-of-type(5):before {
      content:"Total";
  }
  }
  
  #responsive-table{margin:0 0 20px 0;}
  #responsive-table table{width:100%;border-collapse:collapse;}
  #responsive-table th{background:#43904B;font-weight:bold;color:#FFFFFF;}
  #responsive-table td,th{padding:7px 16px;text-align:left;border:0;border-style:solid;border-bottom:thin solid #E6E6E6;}
  </code></pre>
  
  <h1>Some things I have tried:</h1>
  
  <ul>
  <li>Sending the email through Apple iCloud mail to the same iPhone. Result: No change.</li>
  <li>Viewing the email in the Gmail iOS app. Result: Renders perfectly.</li>
  <li>Removed all comments (you never know). Result: No change.</li>
  <li>Changed <code>&lt;meta name="viewport" content="width=320, target-densitydpi=device-dpi"&gt;</code> to <code>&lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;</code> Result: No change.</li>
  </ul>
  
  <h1>Misc.</h1>
  
  <p>If it's any help, this is what useragentstring.com tells me the user agent is for the mail app (I sent myself an email with it in an iframe. No clue if this is correct procedure.).</p>
  
  <pre><code>Mozilla/5.0 (iPhone; CPU iPhone OS 7_1_1 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Mobile/11D201
  </code></pre>
  
  <p>Which is missing the bit about Safari at the end when you use the browser to view the page.</p>
  
  <pre><code>Mozilla/5.0 (iPhone; CPU iPhone OS 7_1_1 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Version/7.0 Mobile/11D201 Safari/9537.53
  </code></pre>
  
  <p>For the curious, I started <a href="http://css-tricks.com/responsive-data-tables/" rel="nofollow noreferrer">with this</a>.</p>
  
  <h1>Updates</h1>
  
  <ul>
  <li>Added <code>word-wrap: normal !important;</code> to #responsive-table td {} which fixes the vertical text glitch.</li>
  <li><a href="http://jsfiddle.net/DTqgu/" rel="nofollow noreferrer">Changing <code>position: relative;</code> to <code>position: absolute;</code></a> results in the following screenshot. This is not what I want, but the Mail app does render it the same way the browser does. It shows that the Mail app does not like <code>position: relative;</code>.</li>
  </ul>
  
  <p><img src="https://i.stack.imgur.com/CEtf8.png" alt="Fixed vertical text"></p>