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 Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
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 id="container">
<select id="apply-style">
<option value="">Browser Default Style
<option value="flush-left">Flush Left, Ragged Right
<option value="block-justified">Block Justified
<option value="indent-boundary">1em Indent with Boundary, Flush Left, Ragged Right
<option value="indent-2lead-boundary">2lead Indent with Boundary, Flush Left, Ragged Right
<option value="indent-2lead">2lead Indent without Boundary, Justified
<option value="outdent">Outdent, Flush Left, Ragged Right
<option value="continuous">Continuous Text, Pilcrow Divided
<option value="versal-up">Elevated Cap / Versal with Bold Opening
<option value="versal-down">Drop Cap / Versal with Bold Opening
<option value="outdent-versal">Outdent Cap / Versal with Bold Small Caps Opening
<option value="initial-outdent-block">Initial Outdent Block with Section / Midpoint Dividers
</select>
<hr>
<p> Much of the material for this volume was collected during the time that I was preparing for the press the Evolution of Woman, or while searching for data bearing on the subject of sex-specialization. While preparing that book for publication, it was my intention to include within it this branch of my investigation, but wishing to obtain certain facts relative to the foundations of religious belief and worship which were not accessible at that time, and knowing that considerable labor and patience would be required in securing these facts, I decided to publish the first part of the work, withholding for the time being that portion of it pertaining especially to the development of the God-idea.
<p> As mankind construct their own gods, or as the prevailing ideas of the unknowable reflect the inner consciousness of human beings, a trustworthy history of the growth of religions must correspond to the processes involved in the mental, moral, and social development of the individual and the nation.
<p> By means of data brought forward in these later times relative to the growth of the God-idea, it is observed that an independent chain of evidence has been produced in support of the facts recently set forth bearing upon the development of the two diverging lines of sexual demarcation. In other words, it has been found that sex is the fundamental fact not only in the operations of Nature but in the construction of a god.
<p> In the Evolution of Woman it has been shown that the peculiar inheritance of the two sexes, female and male, is the result of the bias given to these separate lines of development during the earliest periods of sex-differentiation; and, as this division of labor was a necessary step in the evolutionary processes, the rate of progress depended outdent-caply on the subsequent adjustment of these two primary elements or forces. A comprehensive study of prehistoric records shows that in an earlier age of existence upon the earth, at a time when woman’s influence was in the ascendancy over that of man, human energy was directed by the altruistic characters which originated in and have been transmitted through the female; but after the decline of woman’s power, all human institutions, customs, forms, and habits of thought are seen to reflect the egoistic qualities acquired by the male.
</section><!-- #container -->
#container {
margin: 0 auto;
padding: 2ex 5em;
max-width: 50em;
font-family: Georgia, serif;
}
#apply-style {
font-size: 4em;
}
p {
font-size: 1em;
line-height: 1em;
margin: 1em 0;
}
.flush-left {
p {
line-height: 1.25em;
margin: 1.25em 0;
}
}
.block-justified {
@extend .flush-left;
p {
text-align: justify;
}
}
.indent-boundary {
@extend .flush-left;
p {
margin: 0.625em;
+ p {
text-indent: 1em;
}
}
}
.indent-2lead-boundary {
@extend .indent-boundary;
p {
margin: 0;
+ p {
text-indent: 2.5em;
}
}
}
.indent-2lead {
@extend .indent-2lead-boundary;
p {
text-align: justify;
}
}
.outdent {
@extend .flush-left;
p {
text-indent: -1em;
}
}
.continuous {
text-align: justify; // on the `#container` itself
@extend .flush-left;
p {
display: inline;
// `text-align: justify` invalid b/c `display: inline`
&::before {
content: "\b6";
font-weight: bold;
}
+ p::before {
padding-left: 1em;
}
}
}
.versal-up {
@extend .flush-left;
p:first-of-type {
&::first-line {
font-weight: bold;
}
&::first-letter {
font-size: 3.5em;
font-weight: normal;
line-height: 1em;
}
}
}
.versal-down {
@extend .indent-2lead;
@extend .versal-up;
p:first-of-type {
&::first-letter {
float: left;
}
}
}
.outdent-versal {
@extend .versal-up;
p {
padding-left: 8em;
}
p:first-of-type {
&::first-line {
font-variant: small-caps;
}
&::first-letter {
font-size: 8em;
float: left;
margin-left: -1em;
margin-top: -1rem; // vertical alignment
}
}
}
.initial-outdent-block {
@extend .flush-left;
p {
text-align: justify;
&::before {
font-weight: bold;
content: '\2767';
}
+ p {
padding-left: 8em;
}
&:first-of-type {
font-size: 1.2em;
&::before {
content: "\a7";
}
}
}
}
document.getElementById('apply-style')
.addEventListener('change', function(){
document.getElementById('container').className = this.value;
});
Also see: Tab Triggers