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.


                <div class="menuWrapper">
  <div class="menuLimiter dragscroll">
    <menu class="menu">
      <li class="menu-item"><a href="/">Новости</a></li>
      <li class="menu-item"><a href="#">Проекты</a></li>
      <li class="menu-item"><a href="#">Книги</a></li>
      <li class="menu-item"><a href="#">Школа</a></li>
      <li class="menu-item is__active"><a href="#">Курсы</a></li>
      <li class="menu-item"><a href="#">Советы</a></li>
      <li class="menu-item"><a href="#">Коворкафе</a></li>
      <li class="menu-item"><a href="#">О компании</a></li>

<script type="text/javascript">
  !function(e,n){"function"==typeof define&&define.amd?define(["exports"],n):n("undefined"!=typeof exports?exports:e.dragscroll={})}(this,function(e){var n,t,o=window,l=document,c="mousemove",r="mouseup",i="mousedown",m="EventListener",d="add"+m,s="remove"+m,f=[],u=function(e,m){for(e=0;e<f.length;)m=f[e++],m=m.container||m,m[s](i,,0),o[s](r,,0),o[s](c,,0);for(f=[]"dragscroll")),e=0;e<f.length;)!function(e,m,s,f,u,a){(a=e.container||e)[d](i,{e.hasAttribute("nochilddrag")&&l.elementFromPoint(n.pageX,n.pageY)!=a||(f=1,m=n.clientX,s=n.clientY,n.preventDefault())},0),o[d](r,{f=0},0),o[d](c,{f&&((u=e.scroller||e).scrollLeft-=n=-m+(m=o.clientX),u.scrollTop-=t=-s+(s=o.clientY),e==l.body&&((u=l.documentElement).scrollLeft-=n,u.scrollTop-=t))},0)}(f[e++])};"complete"==l.readyState?u():o[d]("load",u,0),e.reset=u});


                @font-face {
  src: url( format("woff2"),
       url( format("woff");
  font-family: Bureausans;
  font-weight: normal;
  font-style: normal

html, body {
  margin: 0;
  padding: 0;

.menuWrapper {
  overflow: hidden;

.menuLimiter {
  max-width: 380px;
  padding-bottom: 20px;
  margin-bottom: -20px;
  overflow-x: scroll;
  -webkit-overflow-scrolling: touch;
  -webkit-mask-image: linear-gradient(90deg,transparent 0,rgba(0,0,0,.25) 9px,#000 18px,#000 calc(100% - 18px),rgba(0,0,0,.25) calc(100% - 9px),transparent);
  mask-image: linear-gradient(90deg,transparent 0,rgba(0,0,0,.25) 9px,#000 18px,#000 calc(100% - 18px),rgba(0,0,0,.25) calc(100% - 9px),transparent);

.menu {
  font: 24px/32px Bureausans, Helvetica Neue, Helvetica, Arial, sans-serif;
  display: flex;
  list-style: none;
  padding: 0 10px;
  margin: 0;

.menu-item {
  margin-right: 15px;
  white-space: nowrap;

.menu-item:last-child {
  margin-right: 0;
  padding-right: 15px;

.menu-item a {
  color: #000;
  border: 0;
  box-shadow: none;
  text-decoration: none;

.menu-item a:hover,
.menu-item.is__active a {
  color: #e30016;

.menu-item.is__active {
  pointer-events: none;

.dragscroll {
  cursor: grab;

@media only screen and (max-width: 400px) {
  .menu-item { margin-right: 25px; }

@media only screen and (max-width: 426px) {
  .menu-item { margin-right: 13px; }

@media only screen and (max-width: 450px) {
  .menu-item { margin-right: 20px; }

@media only screen and (max-width: 470px) {
  .menu-item { margin-right: 25px; }

@media only screen and (max-width: 510px) {
  .menu-item { margin-right: 15px; }


                class Menu {
  constructor(el) {
    this.el = el
    this.el.addEventListener('click', this.handleClick.bind(this))
    window.addEventListener('resize', this.scrollToActiveItem.bind(this))
  get activeEl() {
    return this.el.querySelector('.is__active')
  handleClick(e) {

  scrollToActiveItem() {
    if (!this.activeEl) return

    const scrollParent = this.el.parentNode
    const scrollParentWidth = scrollParent.clientWidth
    const activeElWidth = this.activeEl.clientWidth
    const activeElLeftOffset = this.activeEl.offsetLeft

    const isActiveElInvisible = activeElLeftOffset + activeElWidth > scrollParentWidth

    if (isActiveElInvisible) {
      scrollParent.scrollLeft = activeElLeftOffset - (scrollParentWidth / 2) + (activeElWidth / 2)
    } else {
      scrollParent.scrollLeft = 0

new Menu(document.querySelector('.menu'))