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.
<!--Google Now Desktop!-->
<button class="signIn">Sign In</button>
<img src="g" class="background"/>
<div class="holder"></div>
<div class="header">
<h1 class="googleNow">Google</h1>
<div class="searchBar">
<input type="text" id="search"/>
</div>
</div>
<div class="cards">
<div class="card update" id="1">
<img src="https://cdn2.iconfinder.com/data/icons/picons-essentials/57/close-512.png" class="closeButton" id="1"/>
<p class="title">New Version Avaliable</p>
<p class="message">A new version of google now is avaliable for download.</p>
<hr>
<a href="#">Update Google Now</a>
</div>
<div class="card destination" id="2">
<img src="https://cdn2.iconfinder.com/data/icons/picons-essentials/57/close-512.png" class="closeButton" id="1"/>
<p class="title">5 minutes till home</p>
<img src="https://maps.googleapis.com/maps/api/staticmap?center=Brooklyn+Bridge,New+York,NY&zoom=13&size=600x300&maptype=roadmap&markers=color:blue%7Clabel:S%7C40.702147,-74.015794&markers=color:green%7Clabel:G%7C40.711614,-74.012318&markers=color:red%7Clabel:C%7C40.718217,-73.998284&sensor=false"/>
<a href="#">Get Directions</a>
</div>
<div class="card boarding" id="2">
<img src="https://cdn2.iconfinder.com/data/icons/picons-essentials/57/close-512.png" class="closeButton" id="1"/>
<p class="title">Brittish Airways 208</p>
<hr/>
<table>
<tr>
<th>Name</th>
<th>Booking Number</th>
</tr>
<tr>
<td>Mr Johnny Smith</td>
<td>E12345678</td>
</tr>
</table>
<img src="http://www.bwscan.com/wp-content/uploads/2013/12/1.jpg" class="qrCode"/>
<hr/>
<a href="#">View Email</a>
</div>
<div class="card boarding" id="2">
<img src="https://cdn2.iconfinder.com/data/icons/picons-essentials/57/close-512.png" class="closeButton" id="1"/>
<table class="fifty">
<tr>
<td><img src="https://24.media.tumblr.com/tumblr_ltbpin2W3Z1qjhzvpo1_500.jpg"/>
</td>
<td>
<b>The Fault In Our Stars</b><br/>
John Green
</td>
</tr>
</table>
<hr/>
<a href="#">View book</a>
</div>
</div>
<div class="searchResults">
<div class="results card" id="results">
<a href="#">Google</a><br/>
<p style="color:green">www.google.co.uk</p>
<p>The local version of this pre-eminent search engine, offering UK-specific pages as well as world results.</p>
</div>
<div class="results card" id="results">
<a href="#">Google</a><br/>
<p style="color:green">www.google.co.uk</p>
<p>The local version of this pre-eminent search engine, offering UK-specific pages as well as world results.</p>
</div>
<div class="results card" id="results">
<a href="#">Google</a><br/>
<p style="color:green">www.google.co.uk</p>
<p>The local version of this pre-eminent search engine, offering UK-specific pages as well as world results.</p>
</div>
<div class="results card" id="results">
<a href="#">Google</a><br/>
<p style="color:green">www.google.co.uk</p>
<p>The local version of this pre-eminent search engine, offering UK-specific pages as well as world results.</p>
</div>
<div class="results card" id="results">
<a href="#">Google</a><br/>
<p style="color:green">www.google.co.uk</p>
<p>The local version of this pre-eminent search engine, offering UK-specific pages as well as world results.</p>
</div>
<div class="loading">
<div class="loading-dot"></div>
<div class="loading-dot"></div>
<div class="loading-dot"></div>
<div class="loading-dot"></div>
</div>
</div>
@import url(https://fonts.googleapis.com/css?family=Roboto:400,100,100italic,300,300italic,400italic,500,700,500italic,900,700italic,900italic);
* { color:#808080; }
body {
font-family:Roboto;
margin:0px;
background-color:#f2f2f2;
font-weight:300;
min-width:320px;
}
.header {
width:100%;
height:190px;
z-index:100; background:url(https://www.google.com/landing/now/images/now_background.jpg) repeat-x;
position:fixed;
-webkit-animation:headerIntro 1s;
}
.googleNow {
text-align:center;
margin:0px;
padding-top:50px;
color:#ffffff;
font-family:Times New Roman;
font-weight:300;
}
.searchBar {
width:300px;
position:absolute;
bottom:20px;
left:50%;
margin-left:-150px;
}
.searchBar input {
width:100%;
height:40px;
padding-left:5px;
padding-right:5px;
box-sizing:border-box;
border:1px solid #C6C6C6;
border-bottom:3px solid #C6C6C6;
}
.box {
border:1px solid #C6C6C6;
border-bottom:3px solid #C6C6C6;
}
.cards {
padding:20px;
max-width:500px;
margin:0 auto;
padding-top:210px;
}
.card {
width:100%;
background-color:#ffffff;
box-sizing:border-box;
border:1px solid #C6C6C6;
border-bottom:2px solid #C6C6C6;
border-radius:5px;
margin-bottom:20px;
position:Relative;
-webkit-animation:cardIntro 1s;
}
.closeButton {
width:10px;
max-width:10px;
height:10px;
position:absolute;
top:0px;
right:0px;
padding:10px;
cursor:pointer;
opacity:0.5;
}
.title {
font-size:20px;
margin:10px 10px 5px 10px;
}
.message {
margin:10px 10px 5px 10px;
}
.card img {
width:100%;
}
hr {
border:0px;
height:1px;
background-color:#e0e0e0;
margin:0px;
}
.cards a {
display:block;
width:100%;
margin:0px;
color:#0486BA;
text-decoration:none;
padding:5px 0px 5px 10px;
}
.destination .title {
color:#E0A639;
}
.background {
position:fixed;
height:100%;
width:100%;
left:0;
top:0;
}
.background img {
width:100%;
}
.holder {
position:fixed;
height:100%;
width:100%;
top:0;
left:0;
background-color:#ffffff;
-webkit-animation:backgroundIntro 2s;
}
.qrCode {
width:100%;
max-width:500px;
margin:0 auto;
padding:10px 20% 10px 20%;
box-sizing:border-box;
}
.boarding table {
width:100%;
margin:10px;
text-align:left;
margin-bottom:0px;
}
td {
width:50%;
font-size:15px;
}
th {
font-weight:400;
font-size:13px;
}
.fifty {
margin:0px;
padding:0px;
}
.fifty img {
width:auto;
padding:0px;
height:200px;
}
.fifty td {
width:50%;
padding:0px;
}
.signIn {
position:fixed;
top:20px;
right:20px;
padding:7px 15px 7px 15px;
border:0px;
border-radius:3px;
color:#ffffff;
z-index:999999;
background-color:#048FC7;
}
.signIn:active {
background-color:#0374A0;
}
.searchResults {
padding:20px;
max-width:500px;
margin:0 auto;
padding-top:110px;
}
.results {
-webkit-animation:none;
padding:10px;
}
.results a {
color:#0486BA;
}
@-webkit-keyframes cardIntro {
0% { right:100%; opacity:0; }
100% { right:0%; opacity:1; }
}
@-webkit-keyframes backgroundIntro {
0% { opacity:0; }
25% { opacity:0; }
100% { opacity:1; }
}
@-webkit-keyframes headerIntro {
0% { opacity:0; }
100% { opacity:1; }
}
.loading {
opacity:0;
position: fixed;
top: 50%;
left: 50%;
margin: -14px 0 0 -42px;
padding: 10px;
background: rgba(20, 20, 20, 0.9);
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
-webkit-box-shadow: inset 0 0 5px #000, 0 1px 1px rgba(255, 255, 255, 0.1);
-moz-box-shadow: inset 0 0 5px #000, 0 1px 1px rgba(255, 255, 255, 0.1);
-ms-box-shadow: inset 0 0 5px #000, 0 1px 1px rgba(255, 255, 255, 0.1);
-o-box-shadow: inset 0 0 5px #000, 0 1px 1px rgba(255, 255, 255, 0.1);
box-shadow: inset 0 0 5px #000, 0 1px 1px rgba(255, 255, 255, 0.1);
}
.loading-dot {
float: left;
width: 8px;
height: 8px;
margin: 0 4px;
background: white;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
opacity: 0;
-webkit-box-shadow: 0 0 2px black;
-moz-box-shadow: 0 0 2px black;
-ms-box-shadow: 0 0 2px black;
-o-box-shadow: 0 0 2px black;
box-shadow: 0 0 2px black;
-webkit-animation: loadingFade 1s infinite;
-moz-animation: loadingFade 1s infinite;
animation: loadingFade 1s infinite;
}
.loading-dot:nth-child(1) {
-webkit-animation-delay: 0s;
-moz-animation-delay: 0s;
animation-delay: 0s;
}
.loading-dot:nth-child(2) {
-webkit-animation-delay: 0.1s;
-moz-animation-delay: 0.1s;
animation-delay: 0.1s;
}
.loading-dot:nth-child(3) {
-webkit-animation-delay: 0.2s;
-moz-animation-delay: 0.2s;
animation-delay: 0.2s;
}
.loading-dot:nth-child(4) {
-webkit-animation-delay: 0.3s;
-moz-animation-delay: 0.3s;
animation-delay: 0.3s;
}
@-webkit-keyframes loadingFade {
0% { opacity: 0; }
50% { opacity: 0.8; }
100% { opacity: 0; }
}
@-moz-keyframes loadingFade {
0% { opacity: 0; }
50% { opacity: 0.8; }
100% { opacity: 0; }
}
@keyframes loadingFade {
0% { opacity: 0; }
50% { opacity: 0.8; }
100% { opacity: 0; }
}
$(".closeButton").click(function() {
$(this).parent().slideToggle(function() {
$(this).remove();
if($.trim($(".cards").html())=='') {
$(".cards").html(" <div class='card update' id='1'><p class='title'>No More Cards</p><p class='message'>There are no more cards to show at the moment</p></div>");
}
});
});
var mode = 0;
$(".searchResults").slideToggle(0);
$("#search").focus(function() {
$(".header").animate({height:"80px"}, 500);
$(".googleNow").animate({opacity:"0"}, 500);
$(".cards").animate({opacity:"0"}, 500);
$("button").animate({opacity:"0"}, 500);
$(".loading").animate({opacity:"1"}, 500, function() {
$(".cards").slideToggle();
$(".searchResults").slideToggle(500);
mode=1;
}
);
});
$("#search").blur(function() {
$(".header").animate({height:"190px"}, 500);
$(".googleNow").animate({opacity:"1"}, 500);
$(".cards").animate({opacity:"1"}, 500);
$(".loading").animate({opacity:"0"}, 500);
$(".cards").slideToggle(0);
$("button").animate({opacity:"1"}, 500);
$(".searchResults").slideToggle(500);
mode=0;
});
$(window).scroll(function() {
if(mode==0) {
if($(document).scrollTop()>10) {
$(".header").animate({height:"80px"}, 100);
$(".googleNow").animate({opacity:"0"}, 100);
$("button").animate({opacity:"0"}, 100);
}
else {
$(".header").animate({height:"190px"}, 100);
$(".googleNow").animate({opacity:"1"}, 100);
$("button").animate({opacity:"1"}, 100);
}
}
});
Also see: Tab Triggers