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.
<body>
<div class="page-header">
<h2>How to use</h2>
<p> Use the Kindle buttons to page through the article. <a href="#section-1">Click here to start</a>.</p>
</div>
<div class="container">
<div class="screen">
<button onClick="location.href='#section-1'" class="next-button" title="Next Page"></button>
<section id="section-1">
<button onClick="location.href='#section-2'" class="next-button" title="Next Page"></button>
<button onClick="location.href='#section-1'" class="previous-button" title="Previous Page"></button>
<h1>Background</h1>
<p>I didn't used to read. Don't get me wrong, I had books, almost enough to fill a shelf (it was a mix of physics text books and a small but treasured collection of Calvin & Hobbes) but I wasn't "a reader". I didn't go to bed with a book, and picking up a book during the day was not part of my routine.</p>
<p>This all changed about 7 years ago when I made a deal with a colleague, if she watched the TV show Firefly, then I'd read a book that she had recommended. I read that book on a Kindle, and I have barely put the Kindle down since. I'm not saying that I only kept up the habit of reading because of the Kindle, but I'm not sure I would have carried on if I had to order books, wait for them to arrive, and then struggle to read them in the dark while the wife tried to go to sleep next to me.</p>
<p>The first device I bought was the Paperwhite, then I passed that onto the wife and I got a newer version of the Paperwhite, and a while later I bought an even newer generation Paperwhite, more recently I treated myself and upgraded to a Kindle Oasis.</p>
<h1>benefits</h1>
<h2>1 - The dictionary</h2>
<p>Unlike Donald Trump, I don't <em>know all the words</em>, so being able to press my fingertip on a word and see the definition is great. Even more useful than the dictionary is the etymology, I find that learning how a word came to be helps me to remember its definition.</p>
<div class="footer"> Page 1 (25%)</div>
</section>
<section id="section-2">
<button onClick="location.href='#section-3'" class="next-button" title="Next Page"></button>
<button onClick="location.href='#section-1'" class="previous-button" title="Previous Page"></button>
<h2>2 - The backlight</h2>
<p>I mostly read in bed, and unlike my wife, I don't fall asleep as soon as my head hits the pillow, so the backlight on the Kindle is essential for me. On the Oasis as you can change the colour temperature and switch to dark mode (i.e. light text on a dark background, a feature I've attempted to replicate on this page via the Toogle Dark Mode button).</p>
<h2>3 - The clock!</h2>
<p>Ok, this one might seem a bit silly, but as I read when I go to bed, it's useful for me to keep an eye on the time, otherwise I might find myself reading well into the small hours. Like many people these days I don't have a clock in the bedroom as I rely on my phone. Having the clock on the Kindle stops me periodically reaching for my phone.</p>
<h2>4 - Saving quotes</h2>
<p>Not so important when reading fiction (which represents about 80% of what I read), but when I do venture into the world of non-fiction, I often like to save quotes or other useful sections of text so I can easily find them again later. This is a feature of the Kindle that often gets overlooked.</p>
<h2>5 - Kindle Unlimited</h2>
<p>Kindle Unlimited in the UK costs £7.99 pm and includes more than 650,000 books that can be borrowed (up to 20 at a time). I'm probably reading 2-3 books per month via Kindle Unlimited, so for me it makes financial sense.</p>
<div class="footer">Page 2 (50%)</div>
</section>
<section id="section-3">
<button onClick="location.href='#section-3'" class="next-button" title="Next Page"></button>
<button onClick="location.href='#section-2'" class="previous-button" title="Previous Page"></button>
<h2>6 - Whisper sync</h2>
<p>This is Amazon's name for the feature that lets you sync your reading progress across Kindle devices and Kindle apps. When I find myself in the car waiting for one of my kids to finish [insert name of activity that seems really important to them now but they will quit once they become a teenager here], then I'll often fire up the Kindle app on my phone, and start reading where I'd finished off the night before.</p>
<h2>7 - Space</h2>
<p>You can fit more than 2,000 books on an 8GB Kindle, which is redonkulous. I typically have no more than 2 books downloaded to my device, the one I'm currently reading, and the one I'll be reading next. For those who don't like to hoard stuff in their homes (like me), a Kindle is a great space saver.</p>
<div class="footer">Page 3 (75%)</div>
</section>
</div>
</div>
</body>
@import url("https://fonts.googleapis.com/css2?family=Literata:wght@400&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300;0,400;0,600;0,700;1,300;1,400&display=swap");
div.page-header {
font-family: "Open Sans", sans-serif;
width: 650px;
margin: auto;
padding-bottom: 0px;
color: black;
}
div.page-header p {
font-size: 16px;
line-height: 1.7;
}
div.page-header h2 {
line-height: 0px;
font-size: 20px;
text-align: left;
font-weight: bold;
margin-bottom: 10px;
margin-top: 25px;
}
body {
font-family: "Literata", sans-serif;
color: #6e6e6e;
font-size: 14px;
line-height: 1.7;
text-align: left;
}
section {
display: none;
}
section:target {
display: block;
}
section P {
margin: 0;
padding: 0;
}
section P + P {
text-indent: 1.5em;
}
section h1 {
line-height: 1.4;
font-size: 1.7em;
text-align: center;
font-weight: 500;
text-transform: uppercase;
}
section h2 {
line-height: 0px;
font-size: 1em;
text-align: left;
font-weight: bold;
margin-bottom: 10px;
margin-top: 25px;
}
.container {
display: flex;
width: 650px;
height: 740px;
background-color: black;
margin: 50px auto;
border-radius: 14px;
border-style: solid;
filter: drop-shadow(3px -2px 4px gray);
}
.screen {
overflow: hidden;
padding: 25px;
width: 500px;
height: 660px;
background: #eee7d7;
margin-left: 12px;
align-self: center;
border-radius: 3px;
}
.footer {
position: absolute;
bottom: 35px;
font-weight: bold;
font-size: 0.8em;
font-variant-numeric: tabular-nums;
}
.next-button {
position: absolute;
background-color: #0f0f0f;
border-style: solid;
border-width: 1px;
border-color: #3f3f3f;
padding: 30px 5px;
top: 300px;
right: 30px;
cursor: pointer;
border-radius: 16px;
}
.previous-button {
position: absolute;
background-color: #0f0f0f;
border-style: solid;
border-width: 1px;
border-color: #3f3f3f;
padding: 30px 5px;
top: 380px;
right: 30px;
cursor: pointer;
border-radius: 16px;
}
Also see: Tab Triggers