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.
<header>
<h1 class="logo">Landing Page</h1>
</header>
<div class="container">
<h2 class="heading">What does this all mean?</h2>
<p>Nescius magna excepteur appellat, malis cernantur efflorescere nam nam dolor si duis, ullamco elit nulla eu ipsum, te minim noster qui cupidatat eu de ab nulla aliqua eram ad esse mandaremus in incididunt, nulla doctrina mentitum. Qui de ipsum anim noster o ea amet incididunt. Ad aut magna iudicem e magna an a fore fabulas o an iudicem quo quibusdam iis aliquip nisi hic arbitror graviterque, ex qui magna ipsum elit ne ex noster consectetur, sunt appellat eiusmod, magna arbitror do relinqueret. Legam iis senserit.Sed consequat e incurreret, sed duis expetendis comprehenderit se nostrud. Esse pariatur probant e quorum mandaremus litteris, ab ipsum cohaerescant e tamen de ingeniis eu anim si de summis litteris possumus quo ex malis cohaerescant ne quorum ita occaecat non esse in lorem de arbitror a duis. Varias ex ne quid singulis, sint admodum excepteur. In a nisi senserit ut deserunt quis te expetendis coniunctione, aute ingeniis relinqueret id ab quid iudicem. Summis mandaremus ab labore aute. A legam nescius distinguantur, incididunt multos proident, aut te veniam esse sint, eram singulis ex varias amet si eu officia id laborum, irure admodum singulis, ab anim illum et singulis sed velit hic singulis. Eu sint amet malis possumus, irure ne doctrina.</p>
<p>Consequat a lorem, dolor et doctrina. Ab probant te quibusdam si officia eram mentitum, magna incididunt vidisse ea est malis arbitrantur quo commodo tamen incididunt nescius, sed esse hic sunt, nulla senserit arbitrantur do ex est tamen consequat. Esse fidelissimae incididunt quae tempor ex in anim offendit officia e possumus anim deserunt proident, lorem et ubi sint vidisse. Est nisi pariatur consectetur, ne nulla ea duis. Aut lorem familiaritatem o labore commodo vidisse ex malis philosophari doctrina nulla laborum, ita labore eiusmod philosophari sed offendit fugiat laborum eu eu possumus et proident, si quorum minim an quibusdam te se veniam ut illum.</p>
</div>
<div class="banner">
<div class="banner-container">
<h2>Quem iudicem pariatur, quibusdam sunt expetendis deserunt</h2>
<p> in id aliqua duis tamen proident id ea sed tamen culpa sint. Veniam quo doctrina. Fugiat distinguantur incididunt esse ullamco Aut lorem familiaritatem o labore commodo vidisse ex malis philosophari doctrina nulla laborum, ita labore eiusmod philosophari sed offendit.</p>
</div>
</div>
<div class="container">
<h2 class="heading">Really Interesting Heading</h2>
<p>Nescius magna excepteur appellat, malis cernantur efflorescere nam nam dolor si
duis, ullamco elit nulla eu ipsum, te minim noster qui cupidatat eu de ab nulla
aliqua eram ad esse mandaremus in incididunt, nulla doctrina mentitum. Qui de ipsum anim noster o ea amet incididunt. Ad aut magna iudicem e magna an a fore fabulas o an iudicem quo quibusdam iis aliquip nisi hic arbitror graviterque, ex qui magna ipsum elit ne ex noster consectetur, sunt appellat eiusmod, magna arbitror do relinqueret. Legam iis senserit.Sed consequat e incurreret, sed duis expetendis comprehenderit se nostrud. Esse pariatur probant e quorum mandaremus litteris, ab ipsum cohaerescant e tamen de ingeniis eu anim si de summis
litteris possumus quo ex malis cohaerescant ne quorum ita occaecat non esse in lorem de arbitror a duis. Varias ex ne quid singulis, sint admodum excepteur. In a nisi senserit ut deserunt quis te expetendis coniunctione, aute ingeniis relinqueret id ab quid iudicem. Summis mandaremus ab labore aute. Magna quo iis varias incurreret, dolor et possumus a ne dolor senserit offendit quo quis possumus illustriora. Expetendis duis vidisse singulis iis quorum aliquip ubi coniunctione, quae se laborum, an ullamco se officia. Iis summis multos quid appellat an e non consectetur, varias ex aliquip non quae, nulla eu ingeniis et noster sed velit ab aut quae voluptate.</p>
<h2 class="heading">Not So Interesting Heading</h2>
<p>Lorem doctrina o veniam velit, qui fore et irure hic illum offendit voluptatibus qui litteris id tamen incurreret aut e de noster nisi enim a quibusdam et tamen cernantur o in litteris ita aliquip aut aliqua cernantur a proident. Nostrud lorem summis tempor enim, si iudicem distinguantur ubi de lorem offendit concursionibus, ut quae doctrina. Nostrud si nescius. Incurreret ipsum se mandaremus exercitation. Singulis ab anim laborum. Fugiat singulis aut dolore veniam, voluptate malis est doctrina voluptatibus ex se dolor sint e senserit, malis pariatur laboris. Enim domesticarum iudicem summis consequat.Non expetendis e voluptate ea magna ne e fore ingeniis, dolor expetendis doctrina e est mentitum sed mandaremus do dolore adipisicing quamquam dolor iudicem, ea commodo non expetendis, ingeniis ita lorem cernantur ex et enim senserit singulis. Fore quamquam efflorescere, lorem proident e instituendarum, deserunt minim malis tempor lorem do hic quid ea enim. Velit si deserunt sed expetendis aliqua officia admodum. Pariatur do ullamco, nescius do magna. Fore eu id multos probant, si quo noster incididunt, summis te voluptate quo cillum se appellat de laboris, tamen ubi in quem probant si o se despicationes, tamen voluptate probant, magna comprehenderit officia legam deserunt.</p>
</div>
<a href="#" class="top">▲</a>
/* Base Styles */
body{
margin: 0;
padding: 0;
color: #222;
font-size: 16px;
line-height: 1.4em;
font-family: 'Raleway', sans-serif;
}
/* Header */
header{
width: 100%;
height: 40em;/*FallBack*/
height: 100vh;
margin: 0;
overflow: hidden;
background: url(https://farm4.staticflickr.com/3201/2746960560_8711acfc60_o.jpg) no-repeat;
background-size: cover;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.logo{
font-size: 4.2em;
font-weight: 300;
color: #fff;
font-family: 'Poiret One', cursive;
}
/* Page Content */
.container{
margin: 0 auto;
padding: 20px 15px;
max-width: 60%;
}
.heading{
font-size: 1.75em;
margin-bottom: .9em;
line-height: 1em;
}
.banner{
width: 100%;
background: #ED6C4D;
text-align: center;
color: #fff;
}
.banner-container{
margin: 0 auto;
padding: 10px 15px;
max-width: 85%;
}
/* Back To Top Button */
.top{
display: none;
background: #222;
position: fixed;
padding: .6em;
color: #fff;
bottom: 5%;
right: 3%;
text-decoration: none;
border-radius: 3px;
opacity: .65;
font-size: 1.8em;
}
.top:hover{
opacity: 1;
transition: all 1s;
}
/* Media Queries */
@media only screen and (max-width: 600px) {
.logo { font-size: 3em; }
}
@media only screen and (max-width: 320px) {
.logo { font-size: 2.5em; }
.top { padding: .5em; }
}
$(window).on("scroll", function() {
if ($(this).scrollTop() > 300) {
$('.top').fadeIn(400);
} else {
$('.top').fadeOut(400);
}
});
$('.top').on("click", function(e) {
e.preventDefault();
$('html, body').animate({scrollTop: 0}, 300);
});
Also see: Tab Triggers