Search code examples
htmlcssanchor

Div link not redirecting to page


im trying to make a main page for my github account. i found a way to make a div clickable, so im using them as buttons with images and text. However, this specific one (directed to callmeclover.github.io/school.html) will not redirect. Here is my code on the main page (callmeclover.github.io no need to go, but you can.):

.default-link {
  /* all rules required to make the whole div clickable */
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  z-index: 1;
  /* this is a fix for IE7-9 */
  background-color: #ffffff;
  -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
  filter: alpha(opacity=0);
  opacity: 0;
}

.panelsbsc {
  display: inline-block;
  vertical-align: middle;
  -webkit-transform: perspective(1px) translateZ(0);
  transform: perspective(1px) translateZ(0);
  box-shadow: 0 0 1px rgba(0, 0, 0, 0);
  -webkit-transition-duration: 0.3s;
  transition-duration: 0.3s;
  -webkit-transition-property: box-shadow;
  transition-property: box-shadow;
  width: 325px;
  height: 200px;
  position: relative;
  bottom: 100px;
  text-align: center;
  background-color: rgb(39 50 38);
  border-radius: 1em;
}
<div class="panelsbsc" style="position:relative;bottom:405px;left:670px;">
  <h2>School</h2>
  <p>Stuff I do for school.</p>
  <a class="default-link" href="javascript:void(0)" onclick="window.location = 'callmeclover.github.io/school.html';"></a>
</div>


Solution

  • Change tag <a>

     <a class="default-link" href="javascript:void(0)" onclick="window.location = 'callmeclover.github.io/school.html';"></a>
    

    to this

     <a class="default-link" href="https://callmeclover.github.io/school.html"></a>
    

    .default-link {
      /* all rules required to make the whole div clickable */
      position: absolute;
      width: 100%;
      height: 100%;
      top: 0;
      left: 0;
      z-index: 1;
      /* this is a fix for IE7-9 */
      background-color: #ffffff;
      -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
      filter: alpha(opacity=0);
      opacity: 0;
    }
    
    .panelsbsc {
      display: inline-block;
      vertical-align: middle;
      -webkit-transform: perspective(1px) translateZ(0);
      transform: perspective(1px) translateZ(0);
      box-shadow: 0 0 1px rgba(0, 0, 0, 0);
      -webkit-transition-duration: 0.3s;
      transition-duration: 0.3s;
      -webkit-transition-property: box-shadow;
      transition-property: box-shadow;
      width: 325px;
      height: 200px;
      position: relative;
      bottom: 100px;
      text-align: center;
      background-color: rgb(39 50 38);
      border-radius: 1em;
    }
    <div class="panelsbsc" >
      <h2>School</h2>
      <p>Stuff I do for school.</p>
    
     <a class="default-link" href="https://callmeclover.github.io/school.html"></a>
    
    </div>