title: CSS Grid Layout Sidebar toggle
body: <p>This is a question regarding the new CSS Grid system that was recently added to the CSS web standards. This is an example of a layout that I am trying to use:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>html,body{
    height: 100vh;
    width: 100wh;
    padding: 0;
    margin: 0;
    color: #e6e6e6;
  }
  
  body{
    display: grid;
    grid-template-columns: 9fr 300px;
    grid-template-rows: 50px auto 50px;
    grid-template-areas: "header header" 
                        "main chat"
                        "footer footer";
  }
  
  .chat{
    grid-area: chat;
    background-color: brown; 
    overflow: auto;
  }
  .header{
    grid-area: header;
    background-color: black;
  }
  
  .main{
    grid-area: main;
    background-color: maroon;
  }
  
  .footer{
    grid-area: footer;
    background-color: #222;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="header"&gt;
      header
    &lt;/div&gt;
    &lt;div class="main"&gt;
      main
    &lt;/div&gt;
    &lt;div class="chat"&gt;
     chat
    &lt;/div&gt;
    &lt;div class="footer"&gt;
      footer
    &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  <p><a href="https://codepen.io/anon/pen/xrKPLX?editors=1100" rel="nofollow noreferrer" title="View the example in codepen">Codepen example</a></p>
  <p>Now I need to toggle the chat sidebar such that the main div occupies the remaining space. I already know how to do this in flexbox and JavaScript. However, I want to try this using CSS Grids.</p>
  <p>One way would be to do this: <code>grid-template-columns: 1fr 0;</code></p>
  <p>But I want the chat sidebar to be toggled smoothly (like CSS transitions) rather than disappearing abruptly.</p>