Pen Settings

HTML

CSS

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

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

Behavior

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.

HTML

              
                
<div class="s-pag">
  <h2>Core</h2>
  <p>Mouse over on text</p>
  <div class="dem-cor s-sto">
    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat
    non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat
    non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
  </div>
</div>
              
            
!

CSS

              
                .s-pag {
    max-width: 1280px;
    padding:0 .5rem;
    margin-left:auto;
    margin-right:auto;
}
.dem-cor{
  width:50%;
  height:50px;
  overflow:auto;
}
.s-sto-lin:not(.s-sto-on) {
  visibility: hidden;
}

.s-sto-lin.s-sto-on:not(.s-sto-sho){
  visibility: hidden;
}

.s-sto-lin:after,
.s-sto-lin:before {
  content: '';
  position: absolute;
  border: .5rem solid transparent;
}

.s-scr-bot:after,
.s-scr-bot:before {
  border-top: .5rem solid rgba(88, 88, 88, 0.5);
}

.s-scr-top:after,
.s-scr-top:before {
  border-bottom: .5rem solid rgba(88, 88, 88, 0.5);
}

.s-scr-bot:after {
  top: .5rem;
}

.s-scr-top:before {
  top: -.5rem;
}

.s-sto-wr {
  position: relative;
}

.s-sto-lin {
  position: absolute;
  right: 0;
  width: 1rem;
  height: 1rem;
  overflow:hidden;
  background: rgba(255, 255, 255, 0.7);
  border:.5rem solid transparent;
  box-sizing: content-box;
  outline: 1px solid #ccc;
}

.s-sto-lin:visited, .s-sto-lin:active, .s-sto-lin:link{
  outline: 1px solid #ccc;
}

.s-sto-lin:hover {
  background: #fff;
  outline: 1px solid #999;
}

@keyframes sStoAdd {
  from {
    opacity: 0.99;
  }
  to {
    opacity: 1;
  }
}

.s-sto {
  animation-duration: 0.001s;
  animation-name: sStoAdd;
}
              
            
!

JS

              
                let sStoIni = function (tar) {
  if (tar !== undefined) {
    sStoIniTag(tar);
  }
};

let sStoGetLin = function (ele) {
  let par = ele.parentElement;
  let num = ele.getAttribute('s-sto-num');
  return par.querySelector('.s-sto-lin[s-sto-num="' + num + '"]');
};

let sStoIniTag = function (tag) {
  let lin = sStoGetLin(tag);
  if (tag.scrollHeight === tag.clientHeight) {
    lin.classList.remove('s-sto-on');
    lin.classList.remove('s-scr-top');
    lin.classList.remove('s-scr-bot');
    return;
  }
  if (tag.scrollTop) {
    lin.classList.add('s-scr-top');
  }
  if (tag.scrollTop === 0) {
    lin.classList.add('s-scr-bot');
  }
  lin.classList.add('s-sto-on');
};
let sStoNum = 0;
let sStoGetSto = function (ele) {
  let num = ele.getAttribute('s-sto-num');
  let par = ele.parentElement;
  return par.querySelector('.s-sto[s-sto-num="' + num + '"]');
};

let sStolinCli = function (eve) {
  eve.preventDefault();
  let sto = sStoGetSto(this);
  if (this.classList.contains('s-scr-bot')) {
    sto.scrollTop = sto.scrollHeight - sto.clientHeight;
    this.classList.remove('s-scr-bot');
    this.classList.add('s-scr-top');
    return false;
  }
  if (this.classList.contains('s-scr-top')) {
    sto.scrollTop = 0;
    this.classList.remove('s-scr-top');
    this.classList.add('s-scr-bot');
    return false;
  }
};
let sStoAdd = function (eve) {
  if (eve.animationName !== 'sStoAdd') {
    return;
  }
  let lin = document.createElement('a');
  lin.href = '#';
  lin.setAttribute('s-sto-num', sStoNum);
  eve.target.setAttribute('s-sto-num', sStoNum);
  sStoNum++;
  lin.classList.add('s-sto-lin');
  lin.addEventListener("click", sStolinCli);
  eve.target.parentElement.classList.add('s-sto-wr');
  eve.target.after(lin);
  let top = eve.target.offsetTop;
  lin.style.top = top + 'px';
  let lef = eve.target.offsetLeft;
  lin.style.left = lef + 'px';
  eve.target.onmouseover = function (event) {
    lin.classList.add('s-sto-sho');
  };
  lin.onmouseover = function (event) {
    lin.classList.add('s-sto-sho');
  };
  eve.target.onmouseout = function (event) {
    lin.classList.remove('s-sto-sho');
  };
  lin.onmouseout = function (event) {
    lin.classList.remove('s-sto-sho');
  };
  sStoIni(eve.target);
};
if (document.sStoAddReg === undefined) {
  document.addEventListener("animationstart", sStoAdd);
  document.addEventListener("MSAnimationStart", sStoAdd);
  document.addEventListener("webkitAnimationStart", sStoAdd);
  window.addEventListener('resize', sStoIni);
  window.addEventListener('orientationChange', sStoIni);
  document.sStoAddReg = true;
}
              
            
!
999px

Console