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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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.


                <!DOCTYPE html>
<html lang="en">
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=">
  <title>Кнопка наверх для сайта</title>
  <div id="up"></div>


                body {
    min-height: 2000px;
  #up {
    display: block;
    background-color: transparent;
    width: 40px;
    height: 40px;
    border-radius: 100%;
    background-color: #bbb;
    text-align: center;
    position: fixed;
    bottom: 20px;
    left: 20px;
    opacity: 0;
    -webkit-transition: all .3s;
    transition: all .3s;
    z-index: 9999;
    cursor: pointer;
  #up:before {
    content: '↑';
    font-family: sans-serif;
    font-size: 30px;
    position: absolute;
    width: 40px;
    height: 40px;
    left: 50%;
    top: 50%;
    -webkit-transform: translate(-50%, -50%);
            transform: translate(-50%, -50%);
  } {
    opacity: 0.5;
  } {
    opacity: 1;


                var btn = $('#up'); //создаем переменную для кнопки

    $(window).scroll(function() {
      if ($(window).scrollTop() > 100) { //отслеживаем высоту от верха страницы в 100px
        btn.addClass('show'); // присваиваем кнопке класс show для управления видимостью
      } else {
        btn.removeClass('show'); // если меньше 500px от верха страницы убираем класс show

    btn.on('click', function(e) {
      $('html, body').animate({scrollTop:0}, '300'); //при клике на кнопку плавно прокручиваем до верха body