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.
<h1>TACO</h1>
<p id="intro" class="closed">My name is Paul and I
<br>appreciate a <strong>good</strong></p>
<div id="global-wrapper">
<section id="taco" class="closed">
<div id="tacoWrapper">
<div class="icon-wrapper">
<i class="fa fa-refresh" id="loading-icon" aria-hidden="true"></i>
</div>
<div class="shell top-layer">
<div class="shadow"></div>
<div class="dots"></div>
<div class="lip"></div>
</div>
<div id="fillings">
<div class="base_layer"></div>
<div class="mixin"></div>
<div class="condiment"></div>
</div>
<div class="shell bottom-layer"></div>
</div>
<div id="btn-wrapper">
<div id="btn-3d">
<p>Make Taco</p>
</div>
</div>
</section>
<section id="info" class="closed">
<div id="ingredients">
<div class="wrapper">
<div class="base-layer-text">
<p></p>
</div>
<div class="condiment-text">
<p></p>
</div>
<div class="mixin-text">
<p></p>
</div>
</div>
</div>
<div id="map">
</div>
<div id="profile">
<p>Every day is taco ipsum tuesday. Say taco one more time. BARBACOA!! 50 cent tacos! I’ll take 30. Give me all the tacos, immediately. I think I’ve overdosed on tacos. Let’s do a beef and a chicken, and one with both. Black or pinto beans? Give me all the tacos, immediately. Tacos al pastor made with adobada meat. How bout a gosh darn quesadilla? Carne asada on corn tortillas. CARNE ASADA!! 50 cent tacos! I’ll take 30. CARNITAS!!
</p>
</div>
</section>
</div>
@import url('https://fonts.googleapis.com/css?family=Teko:300,400,500,600,700');
$font-stack: 'Teko',
'Helvetica',
sans-serif;
$sky: #588C7E;
$shell: #F3C534;
$base-layer: #8E4427;
$mixin: #B8DA48;
$condiment: #D96459;
$button: #F2AE72;
$white: #FFF0F0;
$black: #2A2C2B;
body {
background-color: $sky;
overflow: hidden;
width: 100vw;
}
*::selection {
background-color: lighten($button, 25%);
color: $sky;
}
/*scroll bar*/
::-webkit-scrollbar {
width: 6px;
}
::-webkit-scrollbar-track {
border-radius: 10px;
}
::-webkit-scrollbar-thumb {
background-color: $sky;
border-radius: 8px;
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5);
}
p,
h1,
h2,
h3 {
font-family: $font-stack;
}
h1 {
color: lighten($sky, 10%);
font-size: 50vw;
line-height: 1;
width: 100%;
height: 0;
position: absolute;
z-index: -500;
margin: 0 !important;
padding: 0;
text-align: center;
}
p#intro{
position: absolute;
left: 10%;
margin-top: -50%;
font-size: 2em;
color: $white;
font-weight: 300;
transition-duration: 5s;
&.closed{
display: inline;
margin-top: 2%;
}
strong{
font-weight: 700;
}
}
#global-wrapper {
margin: 0;
padding: 0;
}
section#taco,
section#info {
display: flex;
height: 50vh;
width: 100%;
margin: 0 auto;
float: none;
transition-duration: 1.5s;
transition-delay: .5s;
}
section#taco {
flex-direction: column;
justify-content: center;
align-items: center;
&.closed{
height: 100vh;
}
}
section#info {
background-color: fade-out($black, .10);
flex-wrap: wrap;
flex-direction: column;
justify-content: center;
align-items: center;
&.closed{
margin-bottom: -50vh;
}
#ingredients,#map,#profile{
border: 1px solid $white;
width: 45%
}
#map,#profile{
height: 43%;
}
#ingredients{
height: 86%;
.wrapper{
height: 100%;
display: flex;
flex-direction: column;
.base-layer-text,.condiment-text,.mixin-text{
position: relative;
height: 100%;
margin-left: 4%;
margin-right: 4%;
margin-top: 0;
border-bottom: .5px solid $white;
font-size: 1.15em;
font-weight: 400;
P{
color: $white;
margin: 3px 0;
position: absolute;
bottom: 10%;;
}
&:before{
content:'';
font-family: $font-stack;
font-weight: 300;
font-size: .75em;
color: $sky;
}
}
.base-layer-text{
&:before{
content:'Base Layer';
}
}
.condiment-text{
&:before{
content:'Condiment';
}
}
.mixin-text{
border-bottom: none;
&:before{
content:'Mixin';
}
}
}
}
#profile{
margin-top: 0%;
overflow-y: scroll;
p{
font-size: 1em;
color: $white;
margin: 10px;
}
}
}
#tacoWrapper {
position: relative;
top: 25px;
width: 40%;
max-width: 300px;
min-width: 200px;
height: 150px;
margin-left: auto;
margin-right: auto;
.icon-wrapper{
position: absolute;
z-index: 1000;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
#loading-icon{
display: none;
font-size: 7em;
color: $white;
animation-name: spinner;
animation-duration: .55s;
animation-iteration-count: infinite;
animation-timing-function: linear;
}
}
}
@keyframes spinner{
from {transform: rotate(180deg);}
to {transform: rotate(360deg);}
}
.shell {
position: absolute;
background-color: $shell;
width: 100%;
height: 100%;
border-radius: 100% 100% 5% 10%;
&.top-layer {
z-index: 10;
.shadow {
position: absolute;
bottom: 4px;
z-index: 11;
width: 97%;
height: 11%;
background-color: darken($shell, 8%);
border-radius: 10%;
}
.dots {
position: absolute;
top: 30%;
left: 25%;
background-color: white;
border-radius: 100%;
width: 5px;
height: 5px;
&:before,
&:after {
position: absolute;
background-color: inherit;
border-radius: inherit;
content: '';
height: inherit;
width: inherit;
}
&:before {
top: -5px;
left: 30px;
}
&:after {
top: 10px;
left: 10px;
}
}
}
&.bottom-layer {
z-index: -10;
top: 5px;
left: 7%;
background-color: darken($shell, 10%);
height: 95%;
border-bottom-right-radius: 15%;
}
.lip {
position: absolute;
z-index: -10;
right: -5.5%;
bottom: 6px;
height: 3vw;
width: 2vw;
box-shadow: 0 3px .5px 2px $shell;
border-radius: 50%;
}
}
#fillings {
width: 100%;
height: 100%;
position: absolute;
left: 5%;
.base_layer {
position: absolute;
right: 0;
bottom: 3px;
width: 15%;
height: 50%;
background-color: $base-layer;
border-radius: 25%;
&:after {
content: '';
position: absolute;
right: 4px;
bottom: 10px;
width: 15%;
height: 25%;
background-color: darken($base-layer, 4%);
border-radius: 100%;
}
}
.mixin {
position: absolute;
right: -3%;
bottom: 40%;
width: 30%;
height: 7%;
background-color: $mixin;
border-radius: 400% 0 400% 0;
&:before,
&:after {
position: absolute;
width: 30%;
height: 100%;
content: '';
background-color: $mixin;
border-radius: 400% 0 400% 0;
}
&:before {
right: 5px;
bottom: 100%;
}
&:after {
right: 10px;
bottom: 200%;
transform: rotate(-20deg);
}
}
.condiment {
position: absolute;
right: 3%;
bottom: 40%;
width: 10px;
height: 10px;
background-color: $condiment;
transform: rotate(10deg);
&:before,
&:after {
content: '';
position: absolute;
width: 10px;
height: 10px;
background-color: $condiment;
}
&:before {
right: -2px;
bottom: 25px;
transform: rotate(35deg) scale(.80);
}
&:after {
right: -15px;
bottom: -39px;
transform: rotate(10deg) scale(.75);
}
}
}
/*button style*/
#btn-wrapper {
position: relative;
bottom: -25%;
min-width: 150px;
max-width: 25%;
height: 10%;
min-height: 50px;
color: #333;
&:hover {
animation-name: shake;
animation-duration: 1s;
animation-iteration-count: 1;
animation-timing-function: ease-in-out;
color: $white;
}
}
/*btn animation*/
@keyframes shake {
0% {transform: rotate(1deg);}
20% {transform: rotate(-1deg);}
30% {transform: rotate(2deg);}
40% {transform: rotate(-2deg);}
50% {transform: rotate(3deg);}
60% {transform: rotate(-3deg);}
70% {transform: rotate(2deg);}
80% {transform: rotate(-2deg);}
90% {transform: rotate(-1deg);}
100%{transform: rotate(1deg);}
}
#btn-3d {
background-color: $button;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
&:before,
&:after {
content: '';
position: absolute;
}
&:before {
background-color: darken($button, 5%);
height: 15px;
width: 100%;
top: -14.5px;
left: 7px;
transform: skew(-45deg);
}
&:after {
background-color: darken($button, 10%);
height: 100%;
min-width: 15px;
top: -7px;
right: -14.5px;
transform: skewy(-45deg)
}
p {
font-size: 2em;
color: inherit;
transition-duration: .25s;
}
}
@media screen and (min-width: 770px) {
h1{
}
#global-wrapper{
display: flex;
flex-direction: row;
flex-wrap: nowrap;
}
section#taco,
section#info {
height: 100vh;
width: 50%;
margin: 0 auto;
}
section#taco{
&.closed{
width: 100%;
}
}
section#info{
flex-direction: row;
align-items: center;
align-content: center;
margin-right: 0;
&.closed{
margin-right: -50vw;
margin-bottom: 0;
}
#profile{
width: 92%;
margin-top: 2%;
}
#ingredients{
height: 43%;
}
#map{
margin-left: 2%;
}
}
#btn-wrapper{
margin-top: 100px;
bottom: 0;
}
}
@media screen and (min-width: 700px) {
#tacoWrapper {
height: 200px;
}
}
@media screen and (min-width: 750px) {
#shell .lip {
right: -6.5%;
box-shadow: 0 4px 1px 4px $shell;
}
}
/*screen rotation*/
@media screen and (min-width: 320px) and (max-width: 767px) and (orientation: landscape) {
body{
overflow-y: visible;
}
#tacoWrapper{
display: none;
}
section#info{
height: 150vh;
}
}
var clickedOnce = false;
var cords;
var ingredients = $('.base-layer-text p, .condiment-text p, .mixin-text p');
/*
Special thanks to tacofancy-api
https://github.com/evz/tacofancy-api
*/
function makeTaco() {
var tacosAPI = "https://taco-randomizer.herokuapp.com/random/";
$('#loading-icon').fadeIn(250);
ingredients.hide(500);
setTimeout(function() {
ingredients.html('');
$.ajax({
url: tacosAPI,
dataType: "json"
}).done(function(data) {
$('.base-layer-text p').html(data.base_layer.name);
$('.condiment-text p').html(data.condiment.name);
$('.mixin-text p').html(data.mixin.name);
ingredients.show(400);
$('#loading-icon').delay(600).fadeOut(500);
});
}, 500);
}
function getCords() {
//will connect to google maps in the future
$.get("http://ipinfo.io", function(location) {
console.log(location.loc);
cords = location.loc;
},"jsonp");
}
$('#btn-3d').click(function() {
makeTaco();
if (clickedOnce === false) {
//first click when page is opened
setTimeout(function() {
$('#btn-3d p').html('NEW <i class="fa fa-random" aria-hidden="false"></i>');
},2500);
$('#taco,#info,#intro').removeClass('closed');
clickedOnce = true;
}
})
Also see: Tab Triggers