JSFiddle - React, Tailwind, and code Playground
by Marcelo Augusto
HTML
<div class='container'>
<div class='square'>
<p>ONE</p>
</div>
<div class='square'>
<p>TWO</p>
</div>
<div class='square'>
<p>THREE</p>
</div>
<div class='square'>
<p>FOUR</p>
</div>
<div class='square'>
<p>FIVE</p>
</div>
</div>
<!-- Code by Mark Murray -->
CSS
@import url(http://fonts.googleapis.com/css?family=Open+Sans);
body {
font-family: 'Open Sans', sans-serif;
background: black;
}
.container {
width: 300px;
height: 300px;
position: fixed;
top: 0;
left: 0;
bottom: 0;
right: 0;
margin: auto;
}
.container .square {
width: 100px;
height: 100px;
position: absolute;
color: white;
border: 2px solid white;
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
display: table;
cursor: pointer;
-moz-transition: 0.5s ease all;
-o-transition: 0.5s ease all;
-webkit-transition: 0.5s ease all;
transition: 0.5s ease all;
}
.container .square:hover {
background: white;
color: black;
}
.container .square p {
display: table-cell;
vertical-align: middle;
text-align: center;
-moz-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
-webkit-transform: rotate(-45deg);
transform: rotate(-45deg);
}
.container .square:nth-child(1) {
top: 0;
left: 0;
}
.container .square:nth-child(2) {
bottom: 0;
left: 0;
}
.container .square:nth-child(3) {
right: 0;
top: 0;
}
.container .square:nth-child(4) {
right: 0;
bottom: 0;
}
.container .square:nth-child(5) {
top: 50%;
left: 50%;
-moz-transform: translate(-50%, -50%) rotate(45deg);
-ms-transform: translate(-50%, -50%) rotate(45deg);
-webkit-transform: translate(-50%, -50%) rotate(45deg);
transform: translate(-50%, -50%) rotate(45deg);
}
.highlight {
background: white;
color: black !important;
}