Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
  <header>
    <strong>No scrollbar</strong>
    <nav>
      <a href="#">First link</a>
      <a href="#">Link</a>
      <a href="#">Link</a>
      <a href="#">Link</a>
      <a href="#">Link</a>
      <a href="#">Link</a>
      <a href="#">Link</a>
      <a href="#">Link</a>
      <a href="#">Last link</a>
    </nav>
  </header>
  
  <header>
    <strong>With scrollbar :(</strong>
    <nav>
      <a href="#">First link</a>
      <a href="#">Link</a>
      <a href="#">Link</a>
      <a href="#">Link</a>
      <a href="#">Link</a>
      <a href="#">Link</a>
      <a href="#">Link</a>
      <a href="#">Link</a>
      <a href="#">Last link</a>
    </nav>
  </header>
  <header>
    <strong>Hacking with a parent</strong>
    <div>
      <nav>
        <a href="#">First link</a>
        <a href="#">Link</a>
        <a href="#">Link</a>
        <a href="#">Link</a>
        <a href="#">Link</a>
        <a href="#">Link</a>
        <a href="#">Link</a>
        <a href="#">Link</a>
        <a href="#">Last link</a>
      </nav>
    </div>
  </header>
  
</body>
</html>
 
body {
  max-width: 375px;
  margin: 0 auto;
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", Arial, sans-serif;
  background-color: #fff;
}
header {
  margin: 20px 0;
  padding: 10px 5px;
  text-align: center;
  background-color: #f5f5f5;
  border-bottom: 1px solid #ddd;
}
header > nav {
  position: relative;
  z-index: 2;
  overflow-y: hidden;
  overflow-x: auto;
  text-align: center;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
}
header > nav::-webkit-scrollbar {
  display: none;
}
nav a {
  display: inline-block;
  padding: 5px 10px;
}
header:nth-child(2) nav {
  -webkit-overflow-scrolling: auto;
}
/*
 * Hacked fix with extra padding to hide the scrollbar
 */
header:nth-child(3) div {
  height: 30px;
  overflow-y: hidden;
}
header:nth-child(3) nav {
  padding-bottom: 20px;
  overflow-x: auto;
  text-align: center;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
}
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
mdopro
0viewers