title: Using the table head <th> colspan attribute using styled-components
body: <p>The <code>colspan</code> attribute works fine on a table built with HTML &amp; CSS.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="true">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>th, td { border: 1px solid black }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;table&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th colspan="2"&gt;Major 1&lt;/th&gt;
        &lt;th colspan="2"&gt;Major 2&lt;/th&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;th&gt;col1&lt;/th&gt;
        &lt;th&gt;col2&lt;/th&gt;
        &lt;th&gt;col3&lt;/th&gt;
        &lt;th&gt;col4&lt;/th&gt;
      &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
      &lt;tr&gt;
        &lt;td&gt;data1&lt;/td&gt;
        &lt;td&gt;data2&lt;/td&gt;
        &lt;td&gt;data3&lt;/td&gt;
        &lt;td&gt;data4&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>I am trying to implement this very same thing using <code>styled-components</code>.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="true">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const styled = window.styled;
  
  const LS = {};
  
  LS.TableHead_TH = styled.th`
    /* THINGS I'VE TRIED IN HERE */
    colspan: 2;
    col-span: 2;
    column-span: 2;  /* &lt;--- THIS IS SUGGESTED BY AUTOCOMPLETE */
  `;
  
  function Table() {
    return(
      &lt;table&gt;
        &lt;thead&gt;
          &lt;tr&gt;
            &lt;LS.TableHead_TH&gt;Major 1&lt;/LS.TableHead_TH&gt;
            &lt;LS.TableHead_TH&gt;Major 2&lt;/LS.TableHead_TH&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
            &lt;th&gt;col1&lt;/th&gt;
            &lt;th&gt;col2&lt;/th&gt;
            &lt;th&gt;col3&lt;/th&gt;
            &lt;th&gt;col4&lt;/th&gt;
          &lt;/tr&gt;
        &lt;/thead&gt;
        &lt;tbody&gt;
          &lt;tr&gt;
            &lt;td&gt;data1&lt;/td&gt;
            &lt;td&gt;data2&lt;/td&gt;
            &lt;td&gt;data3&lt;/td&gt;
            &lt;td&gt;data4&lt;/td&gt;
          &lt;/tr&gt;
        &lt;/tbody&gt;
      &lt;/table&gt;
    );
  }
  
  ReactDOM.render(&lt;Table/&gt;, document.getElementById("root"));</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>th, td { border: 1px solid black }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.8.3/umd/react.production.min.js"&gt;&lt;/script&gt;
  &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.8.3/umd/react-dom.production.min.js"&gt;&lt;/script&gt;
  &lt;script src="//unpkg.com/styled-components@4.0.1/dist/styled-components.min.js"&gt;&lt;/script&gt;
  &lt;div id="root"/&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>But as you can see from the snippet, it does not work. And I've tried several properties.</p>
  
  <hr>
  
  <p>If I send it as a regular attribute on my JSX, it still works. Like:</p>
  
  <pre><code>  &lt;LS.TableHead_TH colspan="2"&gt;Major 1&lt;/LS.TableHead_TH&gt;
    &lt;LS.TableHead_TH colspan="2"&gt;Major 2&lt;/LS.TableHead_TH&gt;
  </code></pre>
  
  <p><strong>UPDATE:</strong> Actually the code above worked here on SO. But on my local environment, I had to pass it camelCased, like <code>colSpan</code></p>
  
  <pre><code>  &lt;LS.TableHead_TH colSpan="2"&gt;Major 1&lt;/LS.TableHead_TH&gt;
    &lt;LS.TableHead_TH colSpan="2"&gt;Major 2&lt;/LS.TableHead_TH&gt;
  </code></pre>
  
  <p>What am i doing wrong?</p>
  
  <p>PS: Tested only in Chrome, so far.</p>