cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

Code Indentation

     

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.

            
              <div id="header"></div>
<div id="content"></div>
            
          
!
            
              body{
    font-family:"Segoe UI","Helvetica Neue",Arial,sans-serif;
    padding:0 2%;
    margin:0 auto 10px auto;
    max-width:600px;
    width:96%;
    background-image:url(http://media.mediatemple.netdna-cdn.com/wp-content/themes/smashing-magazine/assets/images/smbg.png);
}
#content{
    background-color:#fff;
    border-bottom-right-radius:10px;
}
ul{
    list-style-type:none;
    margin:0;
    padding:0;
    clear:both;
}
ul a {
    display:block;
    text-align:center;
}
#menu li:first-child a{
    width:150px;
    height:30px;
    padding:25px 10px;
    background-color:#fff;
    background-image:url(http://media.mediatemple.netdna-cdn.com/wp-content/themes/smashing-magazine/assets/images/logo.png);
    background-size:143px 37px;
    background-repeat:no-repeat;
    color:transparent;
    background-position:10px 20px;
}
#menu{
    height:80px;
}
#menu li{
    float:left;
}
#menu li:nth-child(2) a{
    width:80px;
    padding-top:40px;
    padding-bottom:20px;
    color:rgba(0,0,0,.3);
    border-right:1px solid #e5e5e5;
    text-decoration:none;
}            
#categories{
    padding-top:30px;
    padding-left:40px;
    height:36px;
    border-bottom:4px solid rgba(0,0,0,.06);
    background-color:#fff;
    border-top-right-radius:10px;
}
#categories li{
    float:left;
}
#categories li a{
    padding:0 15px;
    height:28px;
    padding-top:8px;
    text-transform:uppercase;
    letter-spacing:2px;
    font-size:0.75em;
    font-weight:bold;
    border-right:1px solid #e5e5e5;
    color:#000;
    text-decoration:none;
}
#categories li:first-child{
    border-bottom:4px solid #63bfb2;
}
#categories li:nth-child(2){
    border-bottom:4px solid #cdeeaa;
}
#articles{
    padding:30px;
}
#articles li{
    padding:10px 0;
    font-size:1.25em;
    border-bottom:1px solid #e5e5e5;
}
#articles a{
    font-family:Georgia,"Times New Roman",Times,serif;
    color:#000;
    text-align:left;
    text-decoration:none;
}
#articles li > span{
    font-family:Georgia,"Times New Roman",Times,serif;
    display:block;  
}
#articles li div{
    font-size:0.75em;
    padding-top:5px;
    color:rgba(0,0,0,.3);
}
#paging{
    border-top:5px solid #41b7d8;
    padding:20px 0 20px 40%;
}
#paging a{
    color:#41b7d8;
    padding:10px;
    margin-right:20px;
    text-decoration:none;
}


            
          
!
            
              var NavigationBackLink = NavigationReact.NavigationBackLink;
var NavigationLink = NavigationReact.NavigationLink;
var RefreshLink = NavigationReact.RefreshLink;
var Menu = React.createClass({
    render: function() {
        return (
            <div>
                <ul id="menu">
                    <li><NavigationLink action="article">Articles</NavigationLink></li>
                    <li><NavigationLink action="book">Books</NavigationLink></li>
                </ul>
                <ul id="categories">
                    <li><NavigationLink action="article" toData={{ category: 'coding' }}>Coding</NavigationLink></li>
                    <li><NavigationLink action="article" toData={{ category: 'design' }}>Design</NavigationLink></li>
                </ul>
            </div>
        );
    }
});
var Articles = React.createClass({
    render: function(){
        var category = this.props.category;
        var articles = getArticles().filter(function name(article) {
            return !category ? true : article.category === category;
        });
        var pages = [];
        for(var i = 0; i < Math.ceil(articles.length / 3); i++){
            pages.push({ page: i + 1 });
        }
        var start = (this.props.page - 1) * 3;
        articles = articles.slice(start, start + 3);
        var articles = articles.map(function (article) {
            return (
                <li>
                    <span>{article.title}</span>
                    <div>By <span>{article.author}</span></div>
                </li>
            );
        });
        var pages = pages.map(function (page) {
            return (
                <RefreshLink toData={{ page: page.page }} includeCurrentData={true}>{page.page}</RefreshLink>
            );
        });
        return (
            <div>
                <ul id="articles">
                    {articles}
                </ul>
                <div id="paging">
                    {pages}
                </div>
            </div>
        );
    }
});
var articleDialog = {
    key: 'article', initial: 'list', states: [
        { key: 'list', route: '{category?}', defaults: { page: 1 } }
    ]
};
var bookDialog = {
    key: 'book', initial: 'list', states: [
        { key: 'list', route: 'books' }
    ]
};
React.render(
    <Menu />,
    document.getElementById('header')
);
Navigation.StateInfoConfig.build([ articleDialog, bookDialog ]);
function showArticles(data){
	React.render(
	    <Articles category={data.category} page={data.page} />,
	    document.getElementById('content')
	);
};
function showBooks(){
	React.render(
	    <div />,
	    document.getElementById('content')
	);
};

var articleDialog = Navigation.StateInfoConfig.dialogs.article;
var articleListState = articleDialog.states.list; 
articleListState.navigated = showArticles;
var bookDialog = Navigation.StateInfoConfig.dialogs.book;
var bookListState = bookDialog.states.list; 
bookListState.navigated = showBooks;

Navigation.start();

function getArticles(){
    return [
        { 
            title: 'Designers And Developers: No Longer A House Divided', 
            author: 'Ivana McConnell', 
            category: 'coding' 
        },
        { 
            title: 'A Better Way To Design For Retina In Photoshop', 
            author: 'Murdoch Carpenter', 
            category: 'design' 
        },
        { 
            title: 'Extending In Sass Without Creating A Mess',
            author: 'David Khourshid', 
            category: 'coding' 
        },
        { 
            title: 'Creating A Complete Web App In Foundation For Apps', 
            author: 'Stephen Saucier', 
            category: 'coding' 
        },
        { 
            title: 'Design Principles: Compositional Flow And Rhythm', 
            author: 'Steven Bradley', 
            category: 'design' 
        },
        { 
            title: 'An In-Depth Overview Of Living Style Guide Tools', 
            author: 'Robert Haritonov', 
            category: 'design' 
        },
        { 
            title: 'React To The Future With Isomorphic Apps', 
            author: 'Jonathan Creamer', 
            category: 'coding' 
        },
        { 
            title: 'Web Scraping With Node.js', 
            author: 'Elliot Bonneville', 
            category: 'coding' 
        },
        { 
            title: 'On China\'s Bleeding Edge: Web Design Trends 2015',
            author: 'Kendra Schaefer', 
            category: 'design' 
        }
    ];
}

            
          
!
999px
Loading ..................

Console