HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
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 affect the whole document, this is the place to do it.
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.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
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.
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-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
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.
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.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
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.
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.
Using packages here is powered by esm.sh, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ESM usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<div class="wrapper">
<header id="nav" role="banner">
<nav role="navigation">
<i class="fa fa-gamepad"></i>
<input type="checkbox" id="nav-check" />
<ul class="nav">
<li><a href="#">Home</a></li>
<li><a href="#">Games</a></li>
<li><a href="#">Events</a></li>
<li><a href="#">News</a></li>
<li><a href="#">Contacts</a></li>
<li><a href="#" class="fa fa-search"></a></li>
</ul>
<label class="fa fa-bars" for="nav-check"></label>
</nav>
</header>
<section class="sec-intro">
<div class="row">
<img src="http://games.mxdwn.com/wp-content/uploads/2014/06/evil-within-4.jpg" alt="The Evil Within picture" />
<img src="http://data.techtimes.com/data/images/full/14561/batman-arkham-knight-gamescom-3-jpg.jpg" alt="Batman: Arkham Knigh picture" />
</div>
<div class="row">
<div class="col-4">
<img src="http://www.dlcompare.com/img/call-of-duty-advanced-warfare-img-4.jpg" alt="Call of Duty: Advanced Warfare" />
</div>
<div class="col-4">
<img src="http://static1.gamespot.com/uploads/original/917/9176928/2556601-0980017126-diablo.jpeg" alt="Diablo 3: Reaper of Souls" />
</div>
<div class="col-4">
<img src="http://s3.goodfon.su/wallpaper/previews-middle/668024.jpg" alt="Metro: Last Light - Redux" />
</div>
<div class="col-4">
<img src="http://static.gamespot.com/uploads/original/1535/15354745/2420857-2571372632-Dark-.jpg" alt="Dark Souls 2" />
</div>
</div>
</section>
<section class="sec-posts">
<div class="row">
<div class="col-2">
<h2>Latest Posts</h2>
<article class="post">
<img src="https://s3.amazonaws.com/ksr/projects/270437/photo-main.jpg?1397791154" alt="Planetary Annihilation picture" />
<h1>Planetary Annihilation</h1>
<p>Colonize solar systems, annihilate homeworlds, and exterminate your foes in epic interplanetary battles with multiple players and thousands of units. Planetary Annihilation is a next-generation RTS that takes the genre to a planetary scale.<span class="icons"><i class="fa fa-comment"></i><i class="fa fa-thumbs-o-up"></i></span></p>
</article>
<article class="post">
<img src="http://im.tiscali.cz/games/2013/09/25/321029-swapperpoutak-653x367.jpg" alt="The Swapper picture" />
<h1>The Swapper</h1>
<p>The Swapper features a unique art style that uses real-world clay-models and found objects to create an explorable space station realised in unique detail; gameplay sees players swap between different bodies to achieve otherwise impossible tasks.<span class="icons"><i class="fa fa-comment"></i><i class="fa fa-thumbs-o-up"></i></span></p>
</article>
<article class="post">
<img src="http://86bb71d19d3bcb79effc-d9e6924a0395cb1b5b9f03b7640d26eb.r91.cf1.rackcdn.com/wp-content/uploads/2014/05/wolfenstein-the-new-order-walkthrough.jpg" alt="Wolfenstein: The New Order picture" />
<h1>Wolfenstein: The New Order</h1>
<p>1946: Europe. World War II rages on across Europe. Where the Allies once pressed advantage, the Nazi forces have turned the tide in dramatic fashion behind the technologically advanced war machine of General Wilhelm Strasse, aka Deathshead.<span class="icons"><i class="fa fa-comment"></i><i class="fa fa-thumbs-o-up"></i></span></p>
</article>
<button type="button" value="See more" role="button">See more</button>
</div>
<div class="col-2">
<h2>Popular Posts</h2>
<article class="post">
<img src="http://nilsenreport.ca/wp-content/uploads/2014/08/NHL15.jpg" alt="NHL 15 picture" />
<h1>NHL 15</h1>
<p>The Skill Stick purports to give more control to the player. Protect the puck, receive passes without breaking stride, and discover an arsenal of sweet new dekes, all with an intuitive right stick control scheme. The game features Doc Emrick and more.<span class="icons"><i class="fa fa-comment"></i><i class="fa fa-thumbs-o-up"></i></span></p>
</article>
<article class="post">
<img src="http://static.trustedreviews.com/94/00002d149/a4fb/Destiny.jpg" alt="Destiny picture" />
<h1>Destiny</h1>
<p>In Destiny (from the creators of Halo) you are a Guardian of the last city on Earth. You are able to wield incredible power. Explore the ancient ruins of our solar system, from the vast dunes of Mars to the lush jungles of Venus. Defeat Earth’s enemies.<span class="icons"><i class="fa fa-comment"></i><i class="fa fa-thumbs-o-up"></i></span></p>
</article>
<article class="post">
<img src="http://wac.450f.edgecastcdn.net/80450F/screencrush.com/files/2013/11/Middle-Earth-Shadow-of-Mordor-Warner-Bros-Interactive.jpg" alt="Middle-earth: Shadow of Mordor picture" />
<h1>Middle-earth: Shadow of Mordor</h1>
<p>Fight your way through Mordor and reveal the truth of the spirit that compels you, discover the origins of the Rings of Power, build your legend and ultimately confront the evil of Sauron in this story of Middle-earth. The release date was set to Sept. 30 2014.<span class="icons"><i class="fa fa-comment"></i><i class="fa fa-thumbs-o-up"></i></span></p>
</article>
<button type="button" value="See more" role="button">See more</button>
</div>
</div>
</section>
<section class="sec-games">
<div class="row">
<h1>Top Games</h1>
<div class="col-4">
<a href="#">
<img src="http://fanboydestroy.files.wordpress.com/2014/05/metro_redux1.jpg" alt="Metro: Redux picture" />
<h2>Metro: Redux</h2>
</a>
</div>
<div class="col-4">
<a href="#">
<img src="http://playstationenthusiast.com/wp-content/uploads/2014/08/The-Last-of-Us-Remastered-large.jpg" alt="The Last of Us Remastered picture" />
<h2>The Last of Us Remastered</h2>
</a>
</div>
<div class="col-4">
<a href="#">
<img src="https://i.imgur.com/nsVNrcn.png" alt="The Evil Within picture" />
<h2>The Evil Within</h2>
</a>
</div>
<div class="col-4">
<a href="#">
<img src="http://www.xboxcentrum.cz/obrazky/watchdogs.jpg" alt="Watch Dogs picture" />
<h2>Watch Dogs</h2>
</a>
</div>
</div>
</section>
<footer>
<div class="footer-outer">
<div class="row">
<div class="col-4">
<h2>Navigation</h2>
<ul class="footer-nav">
<li><a href="#">Home</a></li>
<li><a href="#">Games</a></li>
<li><a href="#">Events</a></li>
<li><a href="#">News</a></li>
<li><a href="#">Contacts</a></li>
</ul>
</div>
<div class="col-4">
<h2>Categories</h2>
<ul class="footer-cat">
<li><a href="#">Action</a></li>
<li><a href="#">Puzzle</a></li>
<li><a href="#">RPG</a></li>
<li><a href="#">Simulation</a></li>
<li><a href="#">Sport</a></li>
<li><a href="#">Strategy</a></li>
</ul>
</div>
<div class="col-4">
<h2>Latest Posts</h2>
<ul class="footer-posts">
<li><a href="#">Planetary Annihilation</a></li>
<li><a href="#">NHL 15</a></li>
<li><a href="#">Wolfenstein: The New Order</a></li>
<li><a href="#">The Swapper</a></li>
<li><a href="#">Destiny</a></li>
<li><a href="#">Middle-earth: Shadow of Mordor</a></li>
</ul>
</div>
<div class="col-4">
<h2>Platforms</h2>
<ul class="footer-platforms">
<li><a href="#">PC</a></li>
<li><a href="#">PS4</a></li>
<li><a href="#">PS3</a></li>
<li><a href="#">Vita</a></li>
<li><a href="#">Xbox One</a></li>
<li><a href="#">Xbox 360</a></li>
<li><a href="#">Wii U</a></li>
<li><a href="#">3DS</a></li>
</ul>
</div>
</div>
</div>
<div class="row">
<span class="copy">Gamer ©, 2014 Privacy Policy</span>
<ul class="soc-media">
<li><a href="https://twitter.com/alexdevero" class="fa fa-twitter" target="_blank"></a></li>
<li><a href="https://facebook.com/lex.devero" class="fa fa-facebook" target="_blank"></a></li>
<li><a href="#nav" class="fa fa-chevron-up"></a></li>
</ul>
</div>
</footer>
</div>
// Variables
$mainColor: #1E90FF; // dodgerblue
$indigo: #4B0082;
// Placeholder variables
%link {
color: $mainColor;
transition: color .25s;
&:focus,
&:hover {color: darken($mainColor, 10%);}
&:active {color: lighten($mainColor, 5%);}
}
/*Typography*/
html {font: 16px "Ubuntu", sans-serif;}
/*Layout*/
html,
body {
width: 100%;
height: 100%;
}
*,
*:before,
*:after {box-sizing: border-box;}
.wrapper {height: 100%;}
section {padding: 1em 0;}
ul {
margin: 0;
padding: 0;
list-style-type: none;
}
a {
text-decoration: none;
transition: all .25s;
}
.row,
nav {
margin: auto;
width: 100%;
max-width: 60em;/*960px*/
}
.col-2 {
display: inline-block;
width: 49%;
min-width: 300px;
vertical-align: top;
}
@media screen and (max-width: 500px) {
.col-2 {
display: block;
margin: auto;
width: 90%;
}
}
.col-4 {
display: inline-block;
width: 24.7%;
min-width: 230px;
vertical-align: top;
}
@media screen and (max-width: 500px) {
.col-4 {
display: block;
margin: auto;
width: 90%;
}
}
/*Navigation*/
header {
float: left;
position: relative;
width: 100%;
background: $mainColor;
box-shadow: 0px 1px 3px #333;
z-index: 1;
}
.fa-gamepad {
display: block;
float: left;
margin-left: .25em;
font-size: 3em;
color: #fff;
cursor: pointer;
}
@media screen and (max-width: 500px) {
.fa-gamepad {
clear: both;
margin-left: 0;
width: 100%;
text-align: center;
}
}
input {display: none;}
input:checked + .nav {display: flex;}
.nav {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: flex-end;
}
@media screen and (max-width: 500px) {
.nav {
display: none;
flex-direction: column;
width: 100%;
}
.nav li {text-align: center;}
}
.nav li:first-child a {background: darken($mainColor, 5%);}
.nav a,
label {
text-align: center;
color: #fff;
&:focus,
&:hover {background: darken($mainColor, 5%);}
&:active {background: lighten($mainColor, 2%);}
}
.nav a {
display: block;
padding: 1em .75em;
}
label.fa {
display: none;
font-size: 2.5em;
cursor: pointer;
}
@media screen and (max-width: 500px) {
label.fa {display: block;}
}
/*Intro*/
.sec-intro {padding-top: 0;}
.sec-intro .row {max-width: 100%;}
.sec-intro .row > img {
float: left;
width: 50%;
height: 480px;
vertical-align: top;
}
@media screen and (max-width: 500px) {
.sec-intro .row > img {width: 100%}
}
.sec-intro .col-4 {
margin-right: -3.5px;
width: 25%;
}
.sec-intro .col-4 img {height: 200px;}
@media screen and (max-width: 930px) {
.sec-intro .col-4 {width: 50%;}
.sec-intro .col-4:nth-child(3),
.sec-intro .col-4:last-child {margin-top: -3px;}
}
@media screen and (max-width: 500px) {
.sec-intro .col-4 {
display: inline-block;
width: 100%;
}
.sec-intro .col-4:nth-child(2),
.sec-intro .col-4:nth-child(3),
.sec-intro .col-4:last-child {margin-top: -3px;}
}
.sec-intro img {width: 100%;}
/*Posts*/
.sec-posts {margin-bottom: 1em;}
.sec-posts .row:first-child {border-top: .1em dashed #aaa;}
@media screen and (max-width: 622px) {
.sec-posts .col-2 {
display: block;
margin: auto;
width: 80%;
}
}
.sec-posts h2 {padding: 0 .25em;}
@media screen and (max-width: 622px) {
h2 {text-align: center;}
}
.post {padding: 0 .5em;}
.post img {
float: left;
margin-right: .5em;
width: 40%;
height: 143px;
}
.post h1 {
display: inline;
font-size: 100%;
cursor: pointer;
@extend %link;
}
.post p {
padding-right: .25em;
font-size: 90%;
text-align: justify;
}
.post span {float: right;}
.post i {
cursor: pointer;
@extend %link;
}
.post i:first-child {margin-right: .5em;}
button {
margin-left: .5em;
padding: .5em 0;
width: 100px;
text-transform: uppercase;
background: #fff;
color: $mainColor;
border: .1em solid;
outline: 0;
transition: color .25s;
&:focus,
&:hover {color: darken($mainColor,10%);}
&:active {color: lighten($mainColor, 5%);}
}
@media screen and (max-width: 500px) {
button {
display: block;
margin: auto;
}
}
/*Games*/
.sec-games {
background: #222;
color: #fff;
}
.sec-games .row {margin-bottom: 2em;}
.sec-games h1 {text-align: center;}
.sec-games .col-4 {padding: 0 .5em;}
@media screen and (max-width: 970px) {
.sec-games .col-4 {width: 49%;}
}
@media screen and (max-width: 500px) {
.sec-games .col-4 {margin-bottom: 1.5em;}
}
.sec-games img {
width: 100%;
height: 190px;
}
.sec-games h2 {
margin: .1em 0;
font-size: 105%;
text-align: center;
color: #C1171C;
transition: color .25s;
}
.sec-games a {transition: color .25s;}
.sec-games a:hover h2 {color: darken(#C1171C, 10%);}
.sec-games a:active h2 {color: lighten(#C1171C, 1%);}
.sec-games p {
margin-top: .5em;
font-size: 80%;
text-align: center;
}
/*Footer*/
.footer-outer {
padding: 1em 0;
background: $mainColor;
color: #fff;
}
footer .row:first-child a {
color: #fff;
&:focus,
&:hover {color: #333;}
&:active {color: #eee;}
}
footer .row:last-child {padding: .5em;}
@media screen and (max-width: 970px) {
footer .col-4 {
width: 49%;
text-align: center;
}
}
@media screen and (max-width: 500px) {
ul {text-align: center;}
}
.copy {font-size: .8em;font-style: italic;}
.soc-media {
float: right;
}
.soc-media li {float: left;}
.soc-media li:not(:last-child) {margin-right: .5em;}
.soc-media a {
display: block;
font-size: 130%;
@extend %link;
}
/*
Created by Alex Devero
More information on
http://alexdevero.com
To learn about HTML5, CSS3 and Javascript visit http://alexsblog.org
*/
Also see: Tab Triggers