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.
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<div class="sidebar-contact">
<div class="toggle"></div>
<h2>Contact Us</h2>
<form action="">
<input type="text" placeholder="Name">
<input type="email" placeholder="Email">
<input type="rel" placeholder="Phone Number">
<textarea placeholder="Message"></textarea>
<input type="submit" value="Send">
</form>
</div>
<div class="banner"></div>
<div class="content">
<h2>What is Loren Ipsum</h2>
<p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Vel pariatur alias ullam dolores provident iusto. Inventore maxime, deleniti delectus corporis incidunt harum voluptates quidem saepe, atque nemo sit? Corrupti dolorum animi facilis excepturi saepe dolore ipsa id perferendis ipsum cumque, asperiores doloremque ullam nemo facere reiciendis, ex velit labore quaerat accusamus suscipit sit? Suscipit perferendis asperiores molestiae tempora earum sunt! Quasi quos cupiditate illo quaerat, sequi aliquam at maiores error, sapiente aperiam aliquid dolores provident excepturi voluptas. Numquam illo iusto soluta alias eligendi, amet enim blanditiis deserunt labore? Recusandae, quisquam nihil harum cumque a adipisci quod eos perferendis eligendi sequi?</p>
<p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Explicabo, recusandae at nulla ut, cupiditate aut aspernatur deleniti animi nisi reiciendis consequatur eum, asperiores voluptas incidunt sunt optio! Odio ex provident quod dicta tenetur voluptatem corrupti minima quos placeat! Quo nobis dignissimos nisi optio commodi reprehenderit, dolor qui vel, eum laborum dolorum magnam possimus cumque nulla dolorem quaerat consectetur? Vero reprehenderit quas obcaecati, sunt eius numquam ratione impedit voluptas quod magnam inventore in quidem suscipit qui aliquam consequatur non debitis enim amet odio ipsam repellat? Labore iusto, ab architecto ipsa odit reprehenderit! Architecto officiis libero excepturi! Molestias fugit repellat dolore labore.</p>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Obcaecati ea architecto in cum, voluptate culpa perferendis accusamus fugit, impedit consequuntur ullam sunt ipsum dolorem ducimus ratione minima. Eveniet ullam quo beatae praesentium fugiat obcaecati vitae excepturi quas sequi possimus, tenetur alias laborum id cumque sed tempora, distinctio error dolorem, aliquam odio? Atque nisi tenetur iste repellendus amet eius provident neque, quae, tempore temporibus nihil dignissimos. Doloremque officia molestiae, soluta vel dolorum fugiat! Doloribus obcaecati commodi iste, totam laudantium voluptatum culpa error nemo necessitatibus quisquam porro labore reprehenderit magni dolor facilis cumque ab asperiores dolorum. Doloribus asperiores tempore blanditiis optio quos.</p>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Ut natus blanditiis vel, expedita laboriosam quia praesentium velit non? Earum ad ea sed corporis natus excepturi hic itaque facilis esse quod temporibus neque distinctio, non voluptatem consequatur ratione! Minus dolor officia laboriosam temporibus quis reiciendis? Excepturi, aut magnam! Dicta nulla harum numquam voluptatem, consequuntur mollitia delectus officia, recusandae incidunt praesentium aperiam accusamus fuga iusto officiis amet nesciunt inventore, autem molestiae. Tempora excepturi ullam nam error similique sunt illo possimus odit? Officia, deleniti. Accusamus, expedita laboriosam officia labore a dicta ex at? Dicta consequatur harum necessitatibus voluptatum excepturi dolor reprehenderit delectus velit.</p>
</div>
</body>
</html>
@import url('https://fonts.googleapis.com/css?family=Montserrat:400,700');
* {
box-sizing: border-box;
}
body {
margin: 0;
padding: 0;
font-family: 'Montserrat', sans-serif;
line-height: 1.4;
}
.banner {
width: 100%;
height: 100vh;
background: url('https://images.pexels.com/photos/547114/pexels-photo-547114.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260');
background-size: cover;
background-attachment: fixed;
}
.content {
padding: 50px 100px;
}
.content h2 {
margin: 0 0 20px;
padding: 0;
font-size: 30px;
}
.content p {
font-size: 18px;
}
.sidebar-contact {
position: fixed;
transform: translateY(-50%);
top: 50%;
left: -350px;
width: 350px;
height: auto;
padding: 40px;
background: #fff;
box-shadow: 0 20px 50px rgba(0,0,0, .5);
transition: 0.5s ease-in-out;
}
.sidebar-contact.active {
left: 0;
}
.sidebar-contact input,
.sidebar-contact textarea{
width: 100%;
height: 36px;
padding: 5px;
margin-bottom: 10px;
border: 1px solid rgba(0,0,0, .5);
outline: none;
}
.sidebar-contact textarea {
height: 60px;
resize: none;
}
.sidebar-contact input[type="submit"] {
background: #00bcd4;
color: #fff;
cursor: pointer;
border: none;
font-size: 18px;
}
.sidebar-contact h2 {
margin: 0 0 20px;
padding: 0;
}
.toggle {
position: absolute;
top: 0;
right: -48px;
width: 48px;
height: 48px;
line-height: 48px;
text-align: center;
cursor: pointer;
background: #f00;
}
.toggle::before {
content: "\f003";
font-family: fontAwesome;
color: #fff;
font-size: 18px;
}
.toggle.active::before {
content: '\f00d';
}
$(document).ready(function(){
$('.toggle').click(function() {
$('.sidebar-contact').toggleClass('active');
$('.toggle').toggleClass('active');
})
});
Also see: Tab Triggers