Add Class(es) to <html>

Adding Classes

In CodePen, whatever you write in the HTML editor is what goes within the <body> tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html> tag. If you want to add classes there, that can effect the whole document, this is the place to do it.

Stuff for <head>

About the <head>

In CodePen, whatever you write in the HTML editor is what goes within the <body> tags in a basic HTML5 template. If you need things in the <head> of the document, put that code here.

!

Insecure Resource

The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.

CSS Preprocessor

About CSS Preprocessors

CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.

CSS Base

About CSS Base

It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.

NormalizeResetNeither

Vendor Prefixing

About Vendor Prefixing

To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit- or -moz-.

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.

About External Resources

You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.

If the stylesheet 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 CSS 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.

JavaScript Preprocessor

About JavaScript Preprocessors

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.

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.

About External Resources

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.

JS

var app = angular.module('app', ['NavigationAngular']);
app.controller('Controller', function ($scope) {
$scope.mode;
$scope.articles;
$scope.pages;
$scope.showArticles = function(data){
$scope.mode ='articles';
var articles = getArticles().filter(function name(article) {
return !data.category ? true : article.category === data.category;
});
$scope.pages = [];
for(var i = 0; i < Math.ceil(articles.length / 3); i++){
$scope.pages.push({ page: i + 1 });
}
var start = (data.page - 1) * 3;
articles = articles.slice(start, start + 3);
$scope.articles = articles;
};
$scope.article;
$scope.showArticle = function(data){
$scope.mode = 'article';
var article = getArticles().filter(function name(article) {
return article.slug === data.slug;
})[0];
$scope.article = article;
}
$scope.showBooks = function(){
$scope.mode = 'books';
};
Navigation.StateController.onNavigate(function () {
if (!$scope.$$phase)
$scope.$apply();
})
var articleDialog = Navigation.StateInfoConfig.dialogs.article;
var articleListState = articleDialog.states.list;
var articleDetailsState = articleDialog.states.details;
articleListState.navigated = $scope.showArticles;
articleDetailsState.navigated = $scope.showArticle;
var bookDialog = Navigation.StateInfoConfig.dialogs.book;
var bookListState = bookDialog.states.list;
bookListState.navigated = $scope.showBooks;
Navigation.start();
});
var articleDialog = {
key: 'article', initial: 'list', states: [
{ key: 'list', route: '{category?}', defaults: { page: 1 }, transitions: [
{ key: 'select', to: 'details' }
], trackCrumbTrail: false},
{ key: 'details', route: 'article/{slug}' }
]
};
var bookDialog = {
key: 'book', initial: 'list', states: [
{ key: 'list', route: 'books', trackCrumbTrail: false }
]
};
Navigation.StateInfoConfig.build([ articleDialog, bookDialog ]);
function getArticles(){
return [
{
title: 'Designers And Developers: No Longer A House Divided',
slug: 'designers-and-developers-no-longer-a-house-divided',
text: 'As the web continues to evolve at a breakneck, Moore\'s-law pace, the divisions between traditional design and development are increasingly shifting. The "learn to code" movement is also gaining momentum among designers, but you\'d be hard pressed to find a similarly strong movement for other disciplines within a team. Perhaps there should be.',
author: 'Ivana McConnell',
category: 'coding'
},
{
title: 'A Better Way To Design For Retina In Photoshop',
slug: 'retina-design-in-photoshop',
text: 'Recently, I had a project in which I needed to produce high-fidelity screens for a tablet. I was to present these screens on the device and also produce a clickable prototype. They needed to be pixel-perfect. The timeline was tight (as always), so I went with my go-to tool, Photoshop. I’ve been using it for over ten years, and it gives me the fastest high-quality output.',
author: 'Murdoch Carpenter',
category: 'design'
},
{
title: 'Extending In Sass Without Creating A Mess',
slug: 'extending-in-sass-without-mess',
text: 'The @extend directive in Sass is a powerful directive that facilitates the sharing of rules and relationships between selectors. However, it can produce undesirable side effects if it is not carefully implemented. Thankfully, there are many strategies for using @extend effectively that can prevent these side effects and produce clean, organized CSS.',
author: 'David Khourshid',
category: 'coding'
},
{
title: 'Creating A Complete Web App In Foundation For Apps',
slug: 'creating-web-app-in-foundation-for-apps',
text: 'Foundation for Apps is a new single-page app framework from Zurb that is closely related to Foundation 5 (also known as Foundation for Sites, a widely used front-end framework). It\'s built around AngularJS and a flexbox grid framework. It\'s intended to make creating a web app very quick and simple, enabling us to quickly start writing the code that’s unique to our application, rather than boilerplate.',
author: 'Stephen Saucier',
category: 'coding'
},
{
title: 'Design Principles: Compositional Flow And Rhythm',
slug: 'design-principles-compositional-flow-and-rhythm',
text: 'When someone lands on a page of your site what do you want that person to do? Where do you want them to look? What information do you want your visitors to notice and in what order?',
author: 'Steven Bradley',
category: 'design'
},
{
title: 'An In-Depth Overview Of Living Style Guide Tools',
slug: 'an-in-depth-overview-of-living-style-guide-tools',
text: 'Following the market\'s demand for minimalistic and consistent UIs, and the growth in modular web development, we tend to pay more and more attention to documentation and the efficiency of designer-engineer workflow with each project we undertake. Also, since the documentation process is often the weakest spot for modern web teams, we\'re constantly looking for the right tools to help us.',
author: 'Robert Haritonov',
category: 'design'
},
{
title: 'React To The Future With Isomorphic Apps',
slug: 'react-to-the-future-with-isomorphic-apps',
text: 'Things often come full circle in software engineering. The web in particular started with servers delivering content down to the client. Recently, with the creation of modern web frameworks such as AngularJS and Ember, we\'ve seen a push to render on the client and only use a server for an API. We\'re now seeing a possible return or, rather, more of a combination of both architectures happening.',
author: 'Jonathan Creamer',
category: 'coding'
},
{
title: 'Web Scraping With Node.js',
slug: 'web-scraping-with-nodejs',
text: 'Web scraping is the process of programmatically retrieving information from the Internet. As the volume of data on the web has increased, this practice has become increasingly widespread, and a number of powerful services have emerged to simplify it. Unfortunately, the majority of them are costly, limited or have other disadvantages. Instead of turning to one of these third-party resources, you can use Node.js to create a powerful web scraper that is both extremely versatile and completely free.',
author: 'Elliot Bonneville',
category: 'coding'
},
{
title: 'On China\'s Bleeding Edge: Web Design Trends 2015',
slug: 'china-web-design-trends-2015',
text: 'There are many parallels between the volatility of the web industry and China\'s breakneck rate of change: For one thing, it\'s hard to keep a finger on the pulse of either. But add the two together and you get China\'s tech scene, a virtual landscape in such constant flux that our only hope of keeping pace is to look as far into the future as we\'re able, try to discern what\'s coming, and brace for impact.',
author: 'Kendra Schaefer',
category: 'design'
}
];
}