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.
<p>The family of Marcus Cato, it is said, was of Tusculan origin, though he lived, previous to his career as soldier and statesman, on an inherited estate in the country of the Sabines. His ancestors commonly passed for men of no note whatever, but Cato himself extols his father, Marcus, as a brave man and good soldier. He also says that his grandfather, Cato, often won prizes for soldierly valour, and received from the state treasury, because of his bravery, the price of five horses which had been killed under him in battle. The Romans used to call men who had no family distinction, but were coming into public notice through their own achievements, "new men," and such they called Cato. But he himself used to say that as far as office and distinction went, he was indeed new, but having regard to ancestral deeds of valour, he was oldest of the old. His third name was not Cato at first, but Priscus. Afterwards he got the surname of Cato for his great abilities. The Romans call a man who is wise and prudent, catus.
<p>As for his outward appearance, he had reddish hair, and keen grey eyes. His bodily habit, since he was addicted from the very first to labour with his own hands, a temperate mode of life, and military duties, was very serviceable, and disposed alike to vigour and health. His discourse, — a second body, as it were, and, for the use of a man who would live neither obscurely nor idly, an instrument with which to perform not only necessary, but also high and noble services, — this he developed and perfected in the villages and towns about Rome, where he served as advocate for all who needed him, and got the reputation of being, first a zealous pleader, and then a capable orator. Thenceforth the weight and dignity of his character revealed themselves more and more to those who had dealings with him; they saw that he was bound to be a man of great affairs, and have a leading place in the state. For he not only gave his services in legal contests without fee of any sort, as it would seem, but did not appear to cherish even the repute won in such contests as his chief ambition. Nay, he was far more desirous of high repute in battles and campaigns against the enemy, and while he was yet a mere stripling, had his breast covered with honourable wounds. He says himself that he made his first campaign when he was seventeen years old, at the time when Hannibal was consuming Italy with the flames of his successes.
<p>In battle, he showed himself effective of hand, sure and steadfast of foot, and of a fierce countenance. With threatening speech and harsh cries he would advance upon the foe, for he rightly thought, and tried to show others, that often-times such action terrifies the enemy more than the sword. On the march, he carried his own armour on foot, while a single attendant followed in charge of his camp utensils. With this man, it is said, he was never wroth, and never scolded him when he served up a meal, nay, he actually took hold himself and assisted in most of such preparations, provided he was free from his military duties. Water was what he drank on his campaigns, except that once in a while, in a raging thirst, he would call for vinegar, or, when his strength was failing, would add a little wine.
@import url(https://fonts.googleapis.com/css?family=Slabo+27px);
$screen-large: 1500px;
$screen-med: 750px;
$screen-small: 420px;
body {
font-family: 'Slabo 27px', serif;
margin: 2rem;
font-size: 1.3rem;
line-height: 1.3;
color: #fff;
background: #333;
@media (max-width: $screen-med) {
background: #000;
line-height: 1.4;
}
}
Also see: Tab Triggers