<div class="scene">
<h1>Simple magic!</h1>
<div class="magic"></div>
<p class="check-out">Check out my other <a href="https://codepen.io/suez/public/" target="_blank">pens</a></p>
</div>
@import "compass/css3";
@font-face {
src: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/142996/Anders.ttf');
font-family: test;
}
*, *:before, *:after {
box-sizing: border-box;
margin: 0;
}
html,body {
font-size: 62.5%;
height: 100%;
overflow: hidden;
}
.scene {
position: relative;
height: 100%;
background: #1d1f20;
padding: 20rem;
text-align: center;
}
h1 {
position: relative;
font-size: 8rem;
text-transform: uppercase;
font-family: test;
color: #fff;
z-index: 10;
}
.magic {
z-index: 5;
position: absolute;
top: calc(50% - 10rem);
left: calc(50% - 10rem);
width: 20rem;
height: 20rem;
background: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/142996/hover-reveal.jpg') 50% 50% no-repeat fixed;
background-size: cover;
border-radius: 50%;
}
.check-out {
z-index: 100;
position: absolute;
bottom: 1rem;
left: 50%;
transform: translateX(-50%);
font-size: 2rem;
color: #fff;
font-family: test;
a {
color: rgba(255,170,170,1);
}
}
View Compiled
$(document).ready(function() {
var $magic = $(".magic"),
magicWHalf = $magic.width() / 2;
$(document).on("mousemove", function(e) {
$magic.css({"left": e.pageX - magicWHalf, "top": e.pageY - magicWHalf});
});
});
This Pen doesn't use any external CSS resources.