JavaScript preprocessors can help make authoring JavaScript easier and more convenient. For instance, CoffeeScript can help prevent easy-to-make mistakes and offer a cleaner syntax and Babel can bring ECMAScript 6 features to browsers that only support ECMAScript 5.
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.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
HTML Settings
Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.
<nav>
<a href="#" class="profile icon-user"></a>
<a href="#" class="logo">logo</a>
<a href="#" class="search icon-search"></a>
<div class="main-nav">
<ul>
<li><a href="#">longform</a></li>
<li><a href="#">reviews</a></li>
<li><a href="#">videos</a></li>
<li><a href="#">tech</a></li>
<li><a href="#">science</a></li>
<li><a href="#">entertainment</a></li>
<li><a href="#">cars</a></li>
<li><a href="#">design</a></li>
</ul>
</div>
<div class="fade"></div>
</nav>
//Import icons
@import url('//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.min.css');
//Media query to switch modes
@mixin large {
@media (min-width: 800px) {
@content;
}
}
//Responsive typography (optional)
html {
font-size: 16px;
@include large {
font-size: 18px;
}
}
body {
font-family: -apple-system, Helvetica, Arial, sans-serif;
font-size: 1rem;
font-weight: 500;
line-height: 1.5;
width: 100%;
color: white;
}
a {
transition: opacity 150ms ease;
text-decoration: none;
color: inherit;
&:hover {
opacity: .75;
}
}
nav {
position: relative;
display: flex;
width: 100%;
background: grey;
flex-flow: row wrap;
justify-content: space-between;
@include large {
flex-flow: row nowrap;
}
}
.logo {
margin: .5rem;
text-transform: uppercase;
color: lightGray;
flex: 0 1 auto;
order: 2;
//Move to 1st position and add space on larger devices
@include large {
margin-right: 1rem;
order: 1;
}
}
.profile {
font-size: 1.4rem;
line-height: 1.5rem;
padding: .5rem;
//Non-essential, just OCD
transform: translateY(.05rem);
flex: 0 1 auto;
order: 1;
//Move to 3rd position on larger devices
@include large {
order: 3;
}
}
.search {
font-size: 1.2rem;
line-height: 1.5rem;
padding: .5rem;
flex: 0 1 auto;
order: 3;
//Move to 4th position on larger devices
@include large {
order: 4;
}
}
.main-nav {
overflow-x: scroll;
padding-right: 1rem;
white-space: nowrap;
flex: 1 1 100%;
order: 4;
-webkit-overflow-scrolling: touch;
//Move main navigation to 2nd position or larger devices
@include large {
order: 2;
}
//Allow horizontal scrolling on smaller screens
li {
display: inline-block;
padding: .5rem;
text-transform: capitalize;
}
li:last-child {
margin-right: 2rem;
}
}
//Add visual cue indicating that there is more content
.fade {
position: absolute;
bottom: 0;
right: 0;
width: 5rem;
height: 2rem;
background: linear-gradient( 90deg, rgba(grey, 0), grey);
@include large {
display: none;
}
pointer-events: none;
}
Also see: Tab Triggers