cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <div class="container">
  <h1 id="title">Awesome! SirAbhinavJain!</h1>
</div>
            
          
!
            
              @import url(https://fonts.googleapis.com/css?family=Pacifico);

body {
  /* credits to https://sirabhinavjain.wordpress.com */
  background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEQAAAAiCAAAAADD1SApAAAA5UlEQVR4AYXUMW6EQBAF0TpSS4T//vda2dO0GgiKwDuItwRl7ef6v5L+qNSc+5EL+jZpkTZJm3LBkBxRx2TI5YLzriQ5j//O9+0hLmgz4hoz71BB56kRc552KtjFpvqjnQtWsdHJbueCVWx9Z7dzwSpWQ2q3c8GudMN6tHPBo1hV/9ntXLCK7SsZ44Jd7CXqGBdMsQ+ZdipYldYvf7dzwfwHWqRNDXXBa2Eq9dkgFfgGucA3yAW+QS7wDXKBb5ALfINc4BvkAt8gF/gGucA3yAW+QS7wDXKBb5ALfINc4BvkAt8gFz+Bp+mo8f2VxAAAAABJRU5ErkJggg==');
  padding: 0;
  margin: 0;
}

.container {
  box-shadow: inset 0px 0px 225px 40px rgba(0, 0, 0, 0.75);
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  position: absolute;
}

#title{
  margin: auto;
  display:block;
  position:absolute;
  top:50%;
  left:50%;
  transform: translateX(-50%) translateY(-50%);
  font-family: 'Pacifico', cursive;
	color: white;
  font-size:8em;
  /*one hardcoded shadow to let the thumbnail look prettier*/
  text-shadow: 1px 1px #2cefff, 2px 2px #2cefff, 3px 3px #2cefff, 4px 4px #ff2c86, 5px 5px #ff2c86, 6px 6px #ff2c86;
}
            
          
!
            
              //settings
var shadowLayers = 25;

//generate css value for text-shadow property
function calcTextShadow(xOffset, xSide, yOffset, ySide, shadowLayers) {
  var cssString = "";
  for (var i = 1; i <= shadowLayers; i++) {
    var color = (i > shadowLayers / 2) ? "#2cefff" : "#ff2c86";
    cssString += xSide * xOffset * i + "px " + ySide * yOffset * i + "px " + color + ","
  };
  return cssString;
}

document.addEventListener('mousemove', function(event) {
  var title = document.getElementById('title');

  //detect whether the cursor is on the left or righthandside of the browser window
  //!! Math.sign(0) will throw an exception
  var xSide = Math.sign((window.innerWidth / 2) - event.clientX);
  var ySide = Math.sign((window.innerHeight / 2) - event.clientY);

  //distance from center to mouse in percentage to window border
  var xOffset = Math.abs(((window.innerWidth / 2) - event.clientX) / (window.innerWidth / 2));
  var yOffset = Math.abs(((window.innerHeight / 2) - event.clientY) / (window.innerHeight / 2));

  title.style.textShadow = calcTextShadow(xOffset, xSide, yOffset, ySide, shadowLayers);
});
            
          
!
999px
Loading ..................

Console