JSFiddle - React, Tailwind, and code Playground

by cosoroaba

HTML

<div id="square">
    <div class="corner-wrapper">
        <div id="ctr"></div>
    </div>
</div>

CSS

#square {
    border: 1px solid #CCCCCC;
    display: block;
    height: 400px;
    line-height: 400px;
    margin: 50px auto;
    overflow: hidden;
    position: relative;
    text-align: center;
    width: 400px;
}
.corner-wrapper{
  -webkit-transform: rotate(45deg);  
     -moz-transform: rotate(45deg);  
      -ms-transform: rotate(45deg);  
       -o-transform: rotate(45deg);  
          transform: rotate(45deg);
    clip: rect(0px, 141.421px, 70.7107px, 0px);
    height: 141.421px;
    position: absolute;
    right: -20.7107px;
    top: -20.7107px;
    width: 141.421px;
}
#ctr{
 -webkit-transform: rotate(-45deg);  
     -moz-transform: rotate(-45deg); 
      -ms-transform: rotate(-45deg); 
       -o-transform: rotate(-45deg); 
          transform: rotate(-45deg);
    left: 20.7107px;
    top: 20.7107px;
    background-color: blue;
    display: block;
    height: 100px;
    position: absolute;
    width: 100px;
}

#ctr:hover{
    background-color: green;
}

#ctr:active{
    background-color: red;
}