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.
<link href='https://fonts.googleapis.com/css?family=Lato:100,300,400,700' rel='stylesheet' type='text/css'>
<div id="perspective">
<div id="container">
<div class="face front">
<div id="white"><h1>Contact Me!<br><span>--------</span></h1></div>
</div>
<div class="face back">
<div id="open"></div>
<div id="folds"></div>
<div class="button con">contact form</div>
<div id="letter">
<hgroup>
<h1 id="info">P: 123.456.7890</h1>
<h2>---- or ----</h2>
</hgroup>
<p>
<form action="" method="post" novalidate="novalidate" id="myform">
<span class="Name">
<input type="text" name="Name" value="" size="40" class="nameinput" aria-required="true" aria-invalid="false" placeholder="Name">
</span>
<span class="Email">
<input type="email" name="Email" size="40" class="emailinput" aria-required="true" aria-invalid="false" placeholder="Email" >
</span>
<span class="Subject">
<select name="Subject" class="indent" aria-required="true" aria-invalid="false" >
<option value="None">Subject</option>
<option value="Job">Job Information</option>
<option value="Booking">Booking</option>
</select>
</span>
<span class="Message">
<textarea name="Message" cols="40" rows="10" aria-invalid="false" placeholder="Message"></textarea>
</span>
<input type="submit" value="Send" class="button send">
</form></p>
</div>
</div>
</div>
</div>
<div id="wrapper"></div>
@import "compass/css3";
$gbuttons:#EDC951;
$info:#00A0B0;
$blue: #D4E1FC;
@import url(https://fonts.googleapis.com/css?family=Pacifico);
*{
margin: 0;
padding: 0;
}
html, body{
height: 100%;
background-image:url('http://www.designbolts.com/wp-content/uploads/2013/02/Free-Seamless-Wood-Textures-Patterns-For-3D-Mapping-2.jpg');
//background-repeat:no-repeat;
//background-size:100% 100%;
}
body{
font-family: 'Pacifico', cursive;
-webkit-font-smoothing: antialiased;
}
#wrapper{
width: 100%;
height:100%;
background: hsla(0,0%,5%,.5);
//opacity: .8;
visibility:hidden;
//@include transition( all 1.5s ease-in-out);
}
#perspective{
position:fixed;
top:190px;
left:50%;
margin-left: -200px;
perspective:1000;
}
#container{//adds shadow to envelope
box-shadow: 0px 2px 10px hsla(0,0%,10%,1);
position: relative;
width: 400px;
height: 280px;
transform-style: preserve-3d;
z-index:-6;
@include border-radius(5px);
transform: rotate(3deg);
}
#perspective:hover{
@include transition( all .4s ease-in-out);
cursor: pointer;
transform: rotate(-2deg);
}
.face{
position: absolute;
top:0;
left:0;
width: 100%;
height: 100%;
backface-visibility:hidden;
}
.front{//front of the card before turned
background-image: -webkit-repeating-linear-gradient(150deg, #ff6969, #ff6969 20px,#ffffff 0px,#ffffff 40px,#85adff 0px,#85adff 60px,#ffffff 0px,#ffffff 80px);
background-image: -moz-repeating-linear-gradient(150deg, #ff6969, #ff6969 20px,#ffffff 0px,#ffffff 40px,#85adff 0px,#85adff 60px,#ffffff 0px,#ffffff 80px);
background-image: repeating-linear-gradient(150deg, #ff6969, #ff6969 20px,#ffffff 0px,#ffffff 40px,#85adff 0px,#85adff 60px,#ffffff 0px,#ffffff 80px);
z-index: 20;
@include border-radius(5px);
}
#white{
width:95%;
height:90%;
margin-right: auto;
margin-left:auto;
margin-top: -5px;
background:hsla(54,0%,96%,1);
@include border-radius(5px);
}
.front h1{
color: #948D88;
text-shadow: 0px 1px 1px hsla(0,0%,100%,1);
font-size: 2em;
line-height: 1em;
text-align: center;
padding-top: 100px;
}
.front h1 span{
color: #948D88;
text-shadow: 0px 1px 1px hsla(0,0%,100%,1);
font-size: .8em;
text-align: center;
}
.back{//color of inside of envelope
background: -webkit-linear-gradient(top, hsla(54,0%,96%,1) 0%, hsla(54,0%,56%,1) 100%);
transform:rotateY(-180deg);
}
#open{
position: absolute;
top:0;
left:0;
height: 0;
width: 80px;
border-top: 161px solid hsla(0,0%,85%,1); //envelope flap
border-left: 160px solid transparent;
border-right: 160px solid transparent;
transform-origin:center top;
z-index: 10;
}
#folds{
position: absolute;
top:0px;
left:0px;
width: 0;
height: 0;
border-left: 180px solid hsla(0,0%,90%,1); //left grey fold envelope back
border-top: 140px solid transparent;
border-bottom: 140px solid transparent;
z-index: 5;
}
#folds:after{
content: "";
position: absolute;
bottom:-140px;
left:-180px;
height: 0;
width: 80px;
border-bottom: 155px solid hsla(0,0%,95%,1); //bottom fold envelope back
border-left: 160px solid transparent;
border-right: 160px solid transparent;
}
#folds:before{
content: "";
position: absolute;
top:-140px;
right:-220px;
width: 0;
height: 0;
border-right: 180px solid hsla(0,0%,90%,1); //right grey fold envelope back
border-top: 140px solid transparent;
border-bottom: 140px solid transparent;
}
.button{
@include border-radius(8px);
width: auto; height: auto;
padding: 0 1em;
border-bottom: 4px solid darken( $gbuttons, 20%);
position: relative;
z-index: 11;
@include transition(none);
background-color: $gbuttons;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-weight: bold;
text-shadow: 0 -1px 1px saturate( darken($gbuttons, 20%), 20%);
text-decoration: none;
color: #FFF;
line-height: 50px;
display: inline-block;
@include transition( all .2s ease-in-out);
&:active {
top: 3px;
border-bottom: none;
}
&.active {
background-color: darken( $gbuttons, 10%);
}
&:hover {
background-color: darken( $gbuttons, 10%);
}
}
.button.con{
margin-left: 135px;
margin-top:105px;
}
.button.send{
margin-left: 120px;
//margin-right: auto;
margin-top:5px;
}
#letter{
background: -webkit-linear-gradient(top, hsla(54,0%,96%,1) 0%,hsla(0,0%,98%,1) 70%,hsla(0,0%,95%,1) 100%);
box-shadow: 0px 2px 5px hsla(0,0%,10%,1);
border-radius: 5px;
position: absolute;
top:3px;
left:0;
margin: 0 0 0 5px;
width: 390px;
height: 200px;
overflow: hidden;
z-index: 1;
}
#letter hgroup{
margin-top:20px;
}
#letter hgroup h1{
font-size: 1.8em;
color: #E65A5A;
text-align: center;
text-shadow: 0px 2px 1px hsla(0,0%,100%,1);
}
#letter hgroup h2{
font-size: 1em;
color: hsla(0,0%,70%,1);
margin-top:-20px;
text-align: center;
text-shadow: 0px 1px 1px hsla(0,0%,100%,1);
}
/*#letter p{
color: hsla(0,0%,20%,1);
text-shadow: 0px 1px 1px hsla(0,0%,100%,1);
font-size: 0.85em;
line-height:1.45em;
margin: 30px 50px 0 50px;
}
#letter p:first-letter{
color: hsla(0,63%,57%,1);
text-shadow: 0px 2px 1px hsla(0,0%,100%,1);
font-size: 2.5em;
float: left;
line-height:0em;
padding:10px 10px 0 0;
}*/
//form shtuff
form {
margin-left:auto;
margin-right:auto;
width: 350px;
height:900px;
padding:30px;
border-radius: 10px;
overflow: hidden;
//background: blue;
position:relative;
}
textarea{
width: 300px;
max-width:95%;
min-height: 110px;
max-height: 10%;
//border: 1px solid #0A0A0A;
border-radius: 10px;
background-clip: padding-box;
display: block;
font-family: 'Lato', sans-serif;
font-size: 18px;
color: #fff;
padding-left: 20px;
padding-right: 10px;
padding-top: 12px;
margin-bottom: 20px;
overflow: hidden;
border: 1px solid #B4BDCF;
background: $blue;
box-shadow: inset 0 0 7px #A2AABA, 0 -3px 3px #b9b9b5, 0 4px 4px #f4f4f4;
}
select {
width: 70%;
height: 48px;
line-height: 1.5;
border-radius: 10px;
color: #fff;
display: block;
background: transparent;
background-color: rgba(0,0,0,.4);
margin-bottom: 20px;
display: block;
font-family: 'Lato', sans-serif;
font-size: 18px;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
border: 1px solid #B4BDCF;
background: $blue;
box-shadow: inset 0 0 7px #A2AABA, 0 -3px 3px #b9b9b5, 0 4px 4px #f4f4f4;
}
.nameinput, .emailinput {
width: 300px;
height: 40px;
border-radius: 10px;
background-clip: padding-box;
display: block;
font-family: 'Lato', sans-serif;
font-size: 18px;
color: #fff;
margin-bottom: 20px;
border: 1px solid #B4BDCF;
background: $blue;
box-shadow: inset 0 0 7px #A2AABA, 0 -3px 3px #b9b9b5, 0 4px 4px #f4f4f4;
}
input[type=submit] {
cursor: pointer;
}
input.nameinput {
//background: rgba(0, 0, 0, 0.4);
padding-left: 20px;
}
input.emailinput {
//background: rgba(0, 0, 0, 0.4);
padding-left: 20px;
}
input.message {
//background: rgba(0, 0, 0, 0.4);
padding-left: 20px;
}
select.indent {
padding-left: 20px;
cursor: pointer;
}
::-webkit-input-placeholder {
color: #fff;
}
:-moz-placeholder{
color: #fff;
}
:-ms-input-placeholder {
color: #fff;
}
textarea, input, .indent { outline: none; }
input:focus, textarea:focus, .indent:focus{
background: #ADC6FF;
box-shadow : 0 0 1px 3px #FCB8B8;
border : 1px solid #FCB8B8;
overflow: hidden;
}
/*/Still need to add:
-form validation
-fix send button
-fix middle close
-open on one click?
-fix nudge after opening
-rework form color scheme
*/
// window.alert("sometext");
var C = $('#container'),
A = $('#open'),
L = $('#letter'),
B = $('.button.con'),
H = $('#letter hgroup h2'),
F = $('.front'),
W = $('#wrapper'),
P = $('#perspective'),
closed = true;
$(function() {
// Handler for .ready() called.
$("textarea").text("");
});
F.click(function(){
C.css({
'transition':'all 1s',
'transform':'rotateY(180deg)',
});
A.css({
'transition':'all 1s .5s',
'transform':'rotateX(180deg)',
'z-index': '0'
});
W.css({
'visibility':'visible'
});
});
// open/close and spin
W.click(function() {
var message =$.trim($('textarea').val());
if (message.length > 0) {//they wrote something in the message
var r=confirm("You have not sent your message, would you still like to close the form?");
if (r==false)//they don't want to close
{
return;
}
else //they do want to close. clear message
{
document.getElementById("myform").reset();
}
}
if(closed===false){
L.css({
'transition':'all .7s',
'top':'3px',
'height':'200px'
});
P.css({
'transform':'translateY(0px)'
});
F.css({
'transform':'rotateZ(0deg)'
});
H.css({
'transition':'all .5s',
'transform':'rotateZ(0deg)'
});
C.css({
'transition':'all 1.2s .95s'
});
A.css({
'transition':'all 1.2s .7s'
});
H.css({
'transition':'all .5s'
});
document.getElementById("info").innerHTML = "P:123.456.7890";
closed=true;
}
else{
C.css({
'transition':'all 1s .5s',
});
A.css({
'transition':'all .5s',
});
closed=false;
}
C.css({
'transform':'rotateY(0deg) rotate(3deg)'
});
A.css({
'transform':'rotateX(0deg)',
'z-index': '10'
});
W.css({
//'transition':'all .5s',
'visibility':'hidden'
});
});
// Open letter
B.click(function() {
L.css({
'transition':'all .5s 1s',
'top':'-600px',
'height':'550px'
});
P.css({
'transition':'all 1s',
'transform':'translateY(450px)'
});
H.css({
'transition':'all 1s',
'transform':'rotateZ(180deg)'
});
document.getElementById("info").innerHTML = "Contact Me!";
});
Also see: Tab Triggers