Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

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

Packages

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.

Behavior

Auto Save

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.

HTML

              
                <body>
		<header>
			<nav>	<!-- Navigation link divs   -->
				<ul class="navbar">
					<li id="redlink" onclick="PAGE.switchPage('redlink')" class="link on">
						RED
					</li>
					
					<li id="whitelink" onclick="PAGE.switchPage('whitelink')" class="link">
							WHITE
					</li>
					
					<li id="bluelink" onclick="PAGE.switchPage('bluelink')" class="link">BLUE
					</li> 
          
				</ul>
        
			</nav>
		
		</header>
		
		<article>
			<section id="redpage" class="redpage band">
        THIS IS RED PAGE FULL OF STUFF
			</section> 
			<section id="whitepage" class="whitepage band hidden">
				THIS IS WHITE PAGE FULL OF STUFF
			</section> 
			<section id="bluepage" class="bluepage band hidden">
				THIS IS BLUE PAGE FULL OF STUFF
			</section> 
		</article>
		
    <footer>
      <div class="foot-cont">Oh . . . What An Awful Footer !
      </div>
    </footer>
	</body>
              
            
!

CSS

              
                body{
	text-align: center; 
	margin: 0 auto;
	font-family: Open Sans, sans-serif;
	font-size: 1.4rem;
	color: #000; 
	background-color: orange;
}

header{
	display: flex;
  flex-flow: row wrap;
  justify-content: flex-end;
  align-items: center;
  align-content: center;
	width: 95%;
	height: 100px;
	font-weight: bold;
	text-align: left;
}

nav{
	display: block;
	width: 65%;
	height: 40px;
	text-align: right;
} 

.navbar{
	display: flex;
  flex-flow: row wrap;
  justify-content: flex-end;
  align-items: center;
  align-content: center;
	height: 40px;
	list-style-type: none;
	text-align: justify;
	font-size: 1.4rem;
	margin: 0;
	padding: 0;
}

.cont{
}

nav li{
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  align-content: center;
	padding: 0;
	width: auto;
  margin-left: 10%;
	height: 40px;
	font-weight: bold;
	line-height: 40px;
	text-align: center;
	color: #FFFFFF;
  cursor: pointer;
}

nav li::after {
    position: absolute;
    display: block;
    background-color: #00FFFF;
    bottom: 0;
    left: 0;
    right: 0;
    margin: auto;
    content: '';
    height: 2px;
    width: 0;
    opacity: 0;
    transition: height 1000ms, opacity 1000ms, width 1000ms;
}

nav li:not(.on):hover::after {
    width: 100%;
    height: 3px;
    opacity: 1;
}

.link {
	color: #FFFFFF;
	text-decoration: none !important;
	cursor: pointer;
} 

.on::after {
  height: 3px;
  opacity: 1;
}

.on:hover{
	cursor: none;
	pointer-effects: none;
}


article{
  width: 95%;
  margin: 0 auto;
}

.band{
	height: 800px;
  font-weight: 600;
  font-size: 4rem;
  color: gold;
  text-align: center;
  display: flex;
  justify-content: center; /* align horizontal */
  align-items: center; /* align vertical */
  
}

.hidden{
	display: none;
}

.redpage{
	background-color: #FF0000;
}

.whitepage{
	background-color: #FFFFFF;
}

.bluepage{
	background-color: #0000FF;
}

footer{
  margin: 0 auto;
  width: 95%;
  text-align: center;
  background: #000;
}

.foot-cont{
  height: 100px;
  font-size: 1.4rem;
  font-style: italic;
  color: #FFF;
  display: flex;           /* Important here, heh-heh */
  justify-content: center; /* align horizontal */
  align-items: center; /* align vertical */
}
              
            
!

JS

              
                const PAGE = ( () =>
{
  const switchPage = (pagelink) =>
  {
    const onLink = document.getElementsByClassName("on")[0];			    // Find current nav link element
    const oldPageId = (onLink.id).substring(0,                        // Get id of corresponding page ...
                          (onLink.id).length - 4) + "page";		        // ... by replace "link" with "page" 
    const newPageLink = document.getElementById(pagelink);				    // Find new nav link, i.e. link clicked on
    const newPageId = (newPageLink.id).substring(0, 
                          (newPageLink.id).length - 4) + "page";	    // Deduce id of corresponding page
    if (oldPageId != newPageId)																		    // Only reload when clicking on different page
    {
      onLink.classList.remove("on");															    // Remove active status from old nav link
      newPageLink.classList.add("on");														    // Show new nav link as active page
      document.getElementById(oldPageId).classList.add("hidden");	    // Hide old page content
      document.getElementById(newPageId).classList.remove("hidden");	// Display current page content
    }
  }
  
  return { switchPage: switchPage };
  
}) ();
              
            
!
999px

Console