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.
<section class="container">
<article class="half">
<h1>Azure</h1>
<div class="tabs">
<span class="tab signin active"><a href="#signin">Sign in</a></span>
<span class="tab signup"><a href="#signup">Sign up</a></span>
</div>
<div class="content">
<div class="signin-cont cont">
<form action="#" method="post" enctype="multipart/form-data">
<input type="email" name="email" id="email" class="inpt" required="required" placeholder="Your email">
<label for="email">Your email</label>
<input type="password" name="password" id="password" class="inpt" required="required" placeholder="Your password">
<label for="password">Your password</label>
<input type="checkbox" id="remember" class="checkbox" checked>
<label for="remember">Remember me</label>
<div class="submit-wrap">
<input type="submit" value="Sign in" class="submit">
<a href="#" class="more">Forgot your password?</a>
</div>
</form>
</div>
<div class="signup-cont cont">
<form action="#" method="post" enctype="multipart/form-data">
<input type="name" name="name" id="name" class="inpt" required="required" placeholder="Your name">
<label for="name">Your name</label>
<input type="email" name="email" id="email" class="inpt" required="required" placeholder="Your email">
<label for="email">Your email</label>
<input type="password" name="password" id="password" class="inpt" required="required" placeholder="Your password">
<label for="password">Your password</label>
<div class="submit-wrap">
<input type="submit" value="Sign up" class="submit">
<a href="#" class="more">Terms and conditions</a>
</div>
</form>
</div>
</div>
</article>
<div class="half bg"></div>
</section>
@import "compass/css3";
@import url(https://fonts.googleapis.com/css?family=Lato:400,700);
$bg: #f8f8f8;
$white: #ffffff;
$blue: #263238;
$grey: #d9d9d9;
$plchldr: #999999;
* {@include box-sizing(border-box); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;}
@mixin placeholder {
&::-webkit-input-placeholder {@content;}
&:-moz-placeholder {@content;}
&::-moz-placeholder {@content;}
&:-ms-input-placeholder {@content;}
}
body {
font-family: 'Lato', sans-serif;
background-color: $bg;
.container {
position: relative;
overflow: hidden;
width: 700px;
height: 500px;
margin: 80px auto 0;
background-color: $white;
@include box-shadow(rgba(0,0,0,.1) 0px 10px 30px);
.half {
float: left;
width: 50%;
height: 100%;
padding: 58px 40px 0;
&.bg {
//background: url(https://i.imgur.com/J2JddJ4.jpg);
background-image:url("https://s7.postimg.org/boj7tcxhn/image.jpg");
background-size: 400px;
background-repeat: no-repeat;
}
}
h1 {
font-size: 18px;
font-weight: 700;
margin-bottom: 23px;
text-align: center;
text-indent: 6px;
letter-spacing: 7px;
text-transform: uppercase;
color: $blue;
}
.tabs {
width: 100%;
margin-bottom: 29px;
border-bottom: 1px solid $grey;
.tab {
display: inline-block;
margin-bottom: -1px;
padding: 20px 15px 10px;
cursor: pointer;
letter-spacing: 0;
border-bottom: 1px solid $grey;
@include user-select(none);
transition: all 0.1s ease-in-out;
a {
font-size: 11px;
text-decoration: none;
text-transform: uppercase;
color: $grey;
transition: all 0.1s ease-in-out;
}
&.active,&:hover {
a {
color: $blue;
}
}
&.active {
border-bottom: 1px solid $blue;
}
}
}
.content {
form {
position: relative;
height: 287px;
}
label, input, .more {
&:first-of-type {
@include animation(slideIn 0.4s cubic-bezier(0.37, 0.82, 0.2, 1));
}
&:nth-of-type(2) {
@include animation(slideIn 0.5s cubic-bezier(0.37, 0.82, 0.2, 1));
}
&:nth-of-type(3) {
@include animation(slideIn 0.6s cubic-bezier(0.37, 0.82, 0.2, 1));
}
}
label {
font-size: 12px;
color: $blue;
@include user-select(none);
&:not([for='remember']) {
display: none;
}
}
input {
&.inpt {
font-size: 14px;
display: block;
width: 100%;
height: 42px;
margin-bottom: 12px;
padding: 16px 13px;
color: $plchldr;
border: 1px solid $grey;
background: transparent;
@include border-radius(2px);
@include placeholder {
font-size: 14px;
color: $plchldr;
font-family: 'Lato', sans-serif;
};
&:focus {
border-color: $plchldr;
}
}
&.submit {
font-size: 12px;
line-height: 42px;
display: block;
width: 100%;
height: 42px;
cursor: pointer;
vertical-align: middle;
letter-spacing: 2px;
text-transform: uppercase;
color: $blue;
border: 1px solid $blue;
background: transparent;
@include border-radius(2px);
&:hover {
background-color: $blue;
color: $white;
@include transition(all 0.2s);
}
}
&:focus {
outline: none;
}
}
.checkbox {
margin-top: 4px;
overflow: hidden;
clip: rect(0 0 0 0);
width: 0; height:0;
margin: 17px -1px; padding: 0;
border: 0;
opacity: 0;
visibility: hidden;
& + label {
vertical-align: middle;
display: inline-block;
width: 50%;
&:before {
content: "\A";
color: $plchldr;
font-family: Verdana;
font-weight: bold;
font-size: 8px;
line-height: 10px;
text-align: center;
display: inline-block;
vertical-align: middle;
position:relative;
@include border-radius(2px);
background: transparent;
border: 1px solid $grey;
width: 11px; height: 11px;
margin: -2px 8px 0 0;
}
}
&:checked + label {
&:before {
content: "✓";
}
}
}
.submit-wrap {
position: absolute;
bottom: 0;
width: 100%;
a {
font-size: 12px;
display: block;
margin-top: 20px;
text-align: center;
text-decoration: none;
color: $plchldr;
&:hover {
text-decoration: underline;
}
}
}
.signup-cont { display: none; }
}
}
}
@keyframes slideIn {
0% {
@include opacity(0);
margin-left: -320px;
}
100% {
@include opacity(1);
margin-left: 0px;
}
}
@-webkit-keyframes slideIn {
0% {
@include opacity(0);
margin-left: -320px;
}
100% {
@include opacity(1);
margin-left: 0px;
}
}
.credits {
display: block;
position: absolute;
right: 0;
bottom: 0;
color: $plchldr;
font-size: 14px;
margin: 0 10px 10px 0;
a {
@include opacity(0.8);
color: inherit;
font-weight: 700;
text-decoration: none;
}
}
$('.tabs .tab').click(function(){
if ($(this).hasClass('signin')) {
$('.tabs .tab').removeClass('active');
$(this).addClass('active');
$('.cont').hide();
$('.signin-cont').show();
}
if ($(this).hasClass('signup')) {
$('.tabs .tab').removeClass('active');
$(this).addClass('active');
$('.cont').hide();
$('.signup-cont').show();
}
});
$('.container .bg').mousemove(function(e){
var amountMovedX = (e.pageX * -1 / 30);
var amountMovedY = (e.pageY * -1 / 9);
$(this).css('background-position', amountMovedX + 'px ' + amountMovedY + 'px');
});
Also see: Tab Triggers