Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <button data-position="pointer">
  <label>position: pointer;</label><br />
    Click to switch states

Author: Yogev Ahuvia © All Rights Reserved
A new CSS position property type concept that sets an element
position according to the pointer position while hovering.
On touch-based interface, the pointer position could be the
point(s) of touch.
The new position type supports 3 values:
'pointer': the element will follow pointer
'pointer-x': the element will follow the pointer horizontaly
'pointer-y': the element will follow the pointer verticaly


                @import "compass/css3";

button {
  font-family: monospace;
  font-size: 20px;
  display: block;
  position: pointer;
  top: 50%;
  left: 50%;
  outline: none;
  width: 280px;
  height: 280px;
  margin: -140px -140px;
  border: 0;
  border-radius: 100%;
  opacity: 0.85;
  background-color: rgb(249,119,163);
  @include filter-gradient(#f977a3, #d9666f, vertical);
  @include background-image(linear-gradient(top,  rgba(249,119,163,1) 0%,rgba(217,102,111,1) 100%));
  @include appearance(none);
  box-shadow: inset 0px 1px 1px white, 
              0px 1px 2px rgba(0,0,0,0.3);
  & > label, & > span {
    cursor: inherit;
  & > span {
    font-size: 13px;
  &:hover {
    background-color: rgb(247,175,199);
    @include filter-gradient(#f7afc7, #d9666f, vertical);
    @include background-image(linear-gradient(top,  rgba(247,175,199,1) 0%,rgba(217,102,111,1) 100%));
  &:active {
    box-shadow: 0px 1px 1px white, inset 0px 1px 2px rgba(0,0,0,0.3);
    background-color: rgb(217,102,111);
    @include filter-gradient(#d9666f, #f7afc7, vertical);
    @include background-image(linear-gradient(top,  rgba(217,102,111,1) 0%,rgba(247,175,199,1) 100%));

mark {
  background: none;
  font-weight: bold;
  text-decoration: underline;

body {
  background: #222;
  position: absolute;
  width: 100%;
  height: 100%;


                $(document).on('mousemove', function(e) {
  $('[data-position="pointer"]').css('top', e.pageY).css('left', e.pageX);
  $('[data-position="pointer-x"]').css('left', e.pageX);
  $('[data-position="pointer-y"]').css('top', e.pageY);

$('[data-position^=pointer]').css('position', 'absolute');

$(document).on('mouseenter', function() {

$(document).on('mouseleave', function() {
  $('.item').css({'top':'50%', 'left':'50%'});

function switchPositionType($element, type) {
  $element.attr('data-position', type);
  $('button > label').text('position: '+type+';');

$('button').on('click', function() {
  $('[data-position^=pointer]').each(function(index, element) {
    if ($(this).attr('data-position') == 'pointer')
      switchPositionType($(this), 'pointer-x');
    else if ($(this).attr('data-position') == 'pointer-x')
      switchPositionType($(this), 'pointer-y');
    else if ($(this).attr('data-position') == 'pointer-y')
      switchPositionType($(this), 'pointer');

$(window).on('keydown', function(e) {
  switch (e.keyCode) {
    case 80: // 'p'
      switchPositionType($('button'), 'pointer');
    case 88: // 'x'
      switchPositionType($('button'), 'pointer-x');
    case 89: // 'y'
      switchPositionType($('button'), 'pointer-y');