title: enabling hover on page load in css
body: <p>I am working on a website in which I want to enable hover on page load.</p>
  
  <p>The HTML code which I have used for the tabs are:</p>
  
  <pre><code>&lt;div class="tab"&gt;
    &lt;button class="tablinks" onclick="openCity(event, 'London')"&gt;London&lt;/button&gt;
    &lt;button class="tablinks" onclick="openCity(event, 'Paris')"&gt;Paris&lt;/button&gt;
    &lt;button class="tablinks" onclick="openCity(event, 'Tokyo')"&gt;Tokyo&lt;/button&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>The CSS code which I have use in order to enable London tab content is:</p>
  
  <pre><code>.tab-contents&gt;.active
  {
  display:block;
  }
  </code></pre>
  
  <p>Problem Statement:</p>
  
  <p>I am wondering what changes I should make in the fiddle so that on page load <strong>London tab is always enable with hover</strong>. The content section is already enabled, I just want to enable the tab now with hover.</p>
  
  <p>Code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function openCity(evt, cityName) {
    var i, tabcontent, tablinks;
    tabcontent = document.getElementsByClassName("tabcontent");
    for (i = 0; i &lt; tabcontent.length; i++) {
      tabcontent[i].style.display = "none";
    }
    tablinks = document.getElementsByClassName("tablinks");
    for (i = 0; i &lt; tablinks.length; i++) {
      tablinks[i].className = tablinks[i].className.replace(" active", "");
    }
    document.getElementById(cityName).style.display = "block";
    evt.currentTarget.className += " active";
  }</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>body {
    font-family: Arial;
  }
  
  
  /* Style the tab */
  
  .tab {
    overflow: hidden;
    border: 1px solid #ccc;
    background-color: #f1f1f1;
  }
  
  
  /* Style the buttons inside the tab */
  
  .tab button {
    background-color: inherit;
    float: left;
    border: none;
    outline: none;
    cursor: pointer;
    padding: 14px 16px;
    transition: 0.3s;
    font-size: 17px;
  }
  
  
  /* Change background color of buttons on hover */
  
  .tab button:hover {
    background-color: #ddd;
  }
  
  
  /* Create an active/current tablink class */
  
  .tab button.active {
    background-color: #ccc;
  }
  
  
  /* Style the tab content */
  
  .tabcontent {
    display: none;
    padding: 6px 12px;
    border: 1px solid #ccc;
    border-top: none;
  }
  
  
  /* Style the tab content */
  
  .tab-contents&gt;.active {
    display: block;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;p&gt;Click on the buttons inside the tabbed menu:&lt;/p&gt;
  
  &lt;div class="tab"&gt;
    &lt;button class="tablinks" onclick="openCity(event, 'London')"&gt;London&lt;/button&gt;
    &lt;button class="tablinks" onclick="openCity(event, 'Paris')"&gt;Paris&lt;/button&gt;
    &lt;button class="tablinks" onclick="openCity(event, 'Tokyo')"&gt;Tokyo&lt;/button&gt;
  &lt;/div&gt;
  
  &lt;div class="tab-contents"&gt;
    &lt;div id="London" class="tabcontent active"&gt;
      &lt;h3&gt;London&lt;/h3&gt;
      &lt;p&gt;London is the capital city of England.&lt;/p&gt;
    &lt;/div&gt;
  
    &lt;div id="Paris" class="tabcontent"&gt;
      &lt;h3&gt;Paris&lt;/h3&gt;
      &lt;p&gt;Paris is the capital of France.&lt;/p&gt;
    &lt;/div&gt;
  
    &lt;div id="Tokyo" class="tabcontent"&gt;
      &lt;h3&gt;Tokyo&lt;/h3&gt;
      &lt;p&gt;Tokyo is the capital of Japan.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>