title: Set column width in table with CSS without using <col> or changing the HTML
body: <p>I am trying to set the column widths (different for each column) for a table that does not contain <code>&lt;col&gt;</code>. <strong>The HTML is coming from a database and I cannot change it</strong> (except with javascript, which I'm trying to avoid). I put the table in a <code>&lt;div&gt;</code> with the class <code>articleTable</code>, so I can use that to style it. How can I set the widths for the columns using only CSS? (I'd prefer a solution that works with IE8.)</p>
  
  <p>Here is an example table:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.articleTable table{
    font-size: 14px;
    border-collapse: collapse;
    border: 2px solid #d6e0e9;  
    color: #363636;
    font-family: "Georgia", serif;
    line-height: 24px;
    width: 100%;
  }
  
  .articleTable tr{
    border: 2px solid #d6e0e9;  
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="articleTable"&gt;
     &lt;!--Jimmy Carter's Cabinet--&gt;
     &lt;table border="1" bordercolor="#D6E0E9" cellpadding="4" cellspacing="0"&gt;
        &lt;tbody&gt;
           &lt;tr&gt;
              &lt;td valign="center" colspan="2"&gt;&lt;font class="subheadlarge"&gt;&lt;b&gt;Carter Administration&lt;/b&gt;&lt;/font&gt;&lt;font class="regtext"&gt; (1977–1981)&lt;/font&gt;&lt;/td&gt;
           &lt;/tr&gt;
           &lt;tr&gt;
              &lt;th valign="center" class="regbold"&gt;Position&lt;/th&gt;
              &lt;th valign="center" class="regbold"&gt;Member&lt;/th&gt;
           &lt;/tr&gt;
           &lt;tr&gt;
              &lt;td valign="center" class="regtext"&gt;Vice President&lt;/td&gt;
              &lt;td valign="center" class="regtext"&gt;&lt;a href="vpr042"&gt;Walter F. Mondale&lt;/a&gt;&lt;/td&gt;
           &lt;/tr&gt;
           &lt;tr&gt;
              &lt;td valign="center" class="regtext" rowspan="2"&gt;Secretary of State&lt;/td&gt;
              &lt;td valign="center" class="regtext"&gt;&lt;a href="TJCY147"&gt;Cyrus R. Vance&lt;/a&gt;&lt;/td&gt;
           &lt;/tr&gt;
           &lt;tr&gt;
              &lt;td valign="center" class="regtext"&gt;&lt;a href="TJCY107"&gt;Edmund S. Muskie&lt;/a&gt; (from May 1980)&lt;/td&gt;
           &lt;/tr&gt;
           &lt;tr&gt;
              &lt;td valign="center" class="regtext" rowspan="2"&gt;Secretary of the Treasury&lt;/td&gt;
              &lt;td valign="center" class="regtext"&gt;&lt;a href="TJCY025"&gt;W. Michael Blumenthal&lt;/a&gt;&lt;/td&gt;
           &lt;/tr&gt;
           &lt;tr&gt;
              &lt;td valign="center" class="regtext"&gt;&lt;a href="TJCY102"&gt;G. William Miller&lt;/a&gt; (from August 1979)&lt;/td&gt;
           &lt;/tr&gt;
           &lt;tr&gt;
              &lt;td valign="center" class="regtext"&gt;Secretary of Defense&lt;/td&gt;
              &lt;td valign="center" class="regtext"&gt;&lt;a href="TJCY031"&gt;Harold Brown&lt;/a&gt;&lt;/td&gt;
           &lt;/tr&gt;
           &lt;tr&gt;
              &lt;td valign="center" class="regtext" rowspan="2"&gt;Attorney General&lt;/td&gt;
              &lt;td valign="center" class="regtext"&gt;&lt;a href="TJCY021"&gt;Griffin Bell&lt;/a&gt;&lt;/td&gt;
           &lt;/tr&gt;
           &lt;tr&gt;
              &lt;td valign="center" class="regtext"&gt;Benjamin R. Civiletti (from August 1979)&lt;/td&gt;
           &lt;/tr&gt;
           &lt;tr&gt;
              &lt;td valign="center" class="regtext"&gt;Secretary of the Interior&lt;/td&gt;
              &lt;td valign="center" class="regtext"&gt;&lt;a href="TJCY011"&gt;Cecil B. Andrus&lt;/a&gt;&lt;/td&gt;
           &lt;/tr&gt;
           &lt;tr&gt;
              &lt;td valign="center" class="regtext"&gt;Secretary of Agriculture&lt;/td&gt;
              &lt;td valign="center" class="regtext"&gt;&lt;a href="TJCY022"&gt;Robert Bergland&lt;/a&gt;&lt;/td&gt;
           &lt;/tr&gt;
           &lt;tr&gt;
              &lt;td valign="center" class="regtext" rowspan="2"&gt;Secretary of Commerce&lt;/td&gt;
              &lt;td valign="center" class="regtext"&gt;&lt;a href="TJCY088"&gt;Juanita M. Kreps&lt;/a&gt;&lt;/td&gt;
           &lt;/tr&gt;
           &lt;tr&gt;
              &lt;td valign="center" class="regtext"&gt;&lt;a href="TJCY086"&gt;Philip M. Klutznick&lt;/a&gt; (from January 1980)&lt;/td&gt;
           &lt;/tr&gt;
           &lt;tr&gt;
              &lt;td valign="center" class="regtext"&gt;Secretary of Labor&lt;/td&gt;
              &lt;td valign="center" class="regtext"&gt;F. Ray Marshall&lt;/td&gt;
           &lt;/tr&gt;
           &lt;tr&gt;
              &lt;td valign="center" class="regtext" rowspan="2"&gt;Secretary of Health, Education, and Welfare&lt;/td&gt;
              &lt;td valign="center" class="regtext"&gt;(The Department was dissolved when it was split into the Department of Health and Human Services and the Department of Education by Congress in 1979) Joseph A. Califano Jr.&lt;/td&gt;
           &lt;/tr&gt;
        &lt;/tbody&gt;
     &lt;/table&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>