0

I have the a box as follows :

enter image description here

On hover of the above box, the box flips to this:

enter image description here

This is the HTML code for the block:

<div class='tiles'>
  <div class='col'>
    <a href=""></a>
    <a href="#"></a>
    <a href="#"></a>
    <a href=""></a>
    <div class='box'></div>
  </div>

I am using CSS to display before and after values using content:

       .col:nth-child(2) .box:before {
        content: "Maps Available";
        background: #e4a001;
        }
        .col:nth-child(2) .box:after {
          content:' Google Map : Click    \A'
          'Apple Map: Click \A  \A';

          background:#e4a001;
        }

Now in the above code , I want to include 'href' such that when the user clicks on 'click'(as can be seen in second pic) the user is directed to google & apple maps accordingly. I tried to use attr(href) but it doesnot work. I also understand that we cannot put href in CSS . I understand that CSS cannot be used to achieve this. IS there any alternative out there ?? Any help is welcome.

JAne
  • 97
  • 1
  • 10

1 Answers1

1

Just show and hide the links as you need:

.box {
  width:150px;
  height:150px;
  position:fixed;
  left:50%;
  top:50%;
  transform:translate(-50%, -50%);
}

.front, .back {
  width:100%;
  height:100%;
  position:absolute;
  left:0;
  top:0;
  transition:transform 0.5s linear;
  background-color:#f44336;
  backface-visibility: hidden;
}

.back {
  transform:rotateY(180deg);
}

.box:hover .front {
  transform:rotateY(180deg);
}

.box:hover .back {
  transform:rotateY(0deg);
}
<div class="box">
  <div class="front">
    Maps
  </div>
  <div class="back">
    Google Map: <a href="http://www.google.com">Click</a>
    <br><br>
    Apple Map: <a href="http://www.apple.com">Click</a>
  </div>
</div>
Toastrackenigma
  • 7,604
  • 4
  • 45
  • 55