<div class="container">
<p></p>
<div class="wrap">
<div class="element element-1">
50% 50%
</div>
</div>
<div class="wrap">
<div class="element element-2">
top left
</div>
</div>
<div class="wrap">
<div class="element element-3">
100% 100%
</div>
</div>
<div class="wrap">
<div class="element element-4">
100px 50px
</div>
</div>
</div>
body {
background-color: #F5F5F5;
color: #555;
font-size: 1.1em;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
hr {
margin: 50px 0;
}
.container {
margin: 40px auto;
max-width: 800px;
}
.wrap {
width: 150px;
height: 150px;
border: 2px solid grey;
display: inline-block;
margin: 100px;
}
.element {
width: 150px;
height: 150px;
position: relative;
color: white;
text-align: center;
line-height: 150px;
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
}
.element-1 {
background-color: #009966;
}
.element-2 {
background-color: purple;
-webkit-transform-origin: top left;
-ms-transform-origin: top left;
transform-origin: top left;
}
.element-3 {
background-color: #0099ee;
-webkit-transform-origin: 100% 100%;
-ms-transform-origin: 100% 100%;
transform-origin: 100% 100%;
}
.element-4 {
background-color: orange;
-webkit-transform-origin: 100px 50px;
-ms-transform-origin: 100px 50px;
transform-origin: 100px 50px;
}