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.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="description" content="About Tyler Von Harz">
<meta name="author" content="Tyler Von Harz">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>About me</title>
</head>
<body>
<header>
<h1>A little about myself</h1>
</header>
<figure>
<img src="https://avatars.githubusercontent.com/u/54379034?v=4">
<figcaption>So thats me, Tyler</figcaption>
</figure>
<section>
<h2>Can I layout HTML as well as I can layout that mustache?</h2>
<p>If you mean sloppy and uneven but OK from a distance</p>
<em>then yes</em>
<h3>So let me tell you more about myself and what I'm all about</h3>
<p>They say a picture paints a thousand words, but you know what they say about HTML image maps?</p>
<p>They say <strong>click on an object to learn more about it</strong>, or at least thats what I say.</p>
<br>
<figure>
<img src="https://raw.githubusercontent.com/tylertechtyler/hosted-assets/main/room.png" usemap="#image-map" alt="my-room">
<map name="image-map">
<area target="_self" alt="Cat" title="Cat" href="#cat" coords="187,158,242,161,280,177,286,201,264,203,238,196,224,208,199,213,177,190" shape="poly">
<area target="_self" alt="Books" title="Books" href="#books" coords="228,81,247,106,224,118,197,108,206,85" shape="poly">
<area target="_self" alt="Cows" title="Cows" href="#cows" coords="173,40,175,86,141,89,139,43" shape="poly">
<area target="_self" alt="Cows" title="Cows" href="#cows" coords="292,64,329,67,326,111,288,106" shape="poly">
<area target="_self" alt="Cows" title="Cows" href="#cows" coords="431,72,425,121,376,117,380,70" shape="poly">
<area target="_self" alt="Books" title="Books" href="#books" coords="447,98,430,139,477,149,479,99" shape="poly">
</map>
</figure>
<h3>No but really image maps are the coolest thing you can do with just HTML</h3>
<p>Let me explain what goes into making an image map</p>
<ul>
<li>Pick out an image. (optional: make it interesting)</li>
<li>Host your image in a Github repo so you can access it anywhere</li>
<li>Set your img's <em>usemap</em> attribute to your image-map's <em>name</em> attribute</li>
<li>Set each <em>area</em> of your image-maps coordinates based on what you want to be clickable</li>
<li>Use a tool like MS paint, Photoshop, or free online coordinates generator to find the coordinates</li>
<li>Set each area's <em>target</em> attribute to "_self" so that it opens in the same frame as your img</li>
<li>Don't forget the <em>alt</em> and <em>title</em> attributes.</li>
<li>Go to <a href="https://www.w3schools.com/tags/tag_area.asp">w3schools</a> if you want a decent tutorial</li>
</ul>
<p>That's kinda neat right?</p>
</section>
<hr>
<section>
<h2>OK so an actual about me:</h2>
<p>My name is Tyler. I'm 26. By day I am a computer repair technician. By night I am asleep.<p>
<em>Really, it's exhausting</em>
<p>But in the morning, I wake up with a hunger to work on something cool involving web development until I have to go to work.</p>
<h3>My favorite projects are the kind that are both fun and mostly useless.</h3>
<p>I have been going to college online for computer science for a little while from Western Governor's University, but they don't actually teach you all that much. My best teacher's name was professor Google. We are still very close and I am amazed that he is always around to answer my stupid questions. When I asked him how I can learn to code, he introduced me to some of his close colleagues:</p>
<ul>
<li><a href="freecodecamp.org">Free Code Camp</a></li>
<li><a href="stackoverflow.com">Stack Overflow</a></li>
<li><a href="theodinproject.com">The Odin Project</a></li>
<li><a href="codepen.io">Code Pen</a></li>
</ul>
<h3>I think the best way to learn is to teach</h3>
<p>If I don't know something, I try to study it to the point that I can explain it to my little sister. Sometimes I will just talk to my cat about what I am doing and try to break down technical information into less technical terms.</p>
<blockquote cite="https://www.vitsoe.com/us/about/good-design">"While we teach, we learn"<br>
- Seneca, Roman philosopher
</blockquote>
</section>
<hr>
<section>
<h2>More detailed information</h2>
<p>Here's a cool HTML trick. Use the <details> element to create a collapsable section that the user can click on to reveal more <em>details.</em>
<details>
<summary id="cat">My cat</summary>
<p>My cat, Mittens. She is almost 7 years old. She eats lots of kibble and loves laying in bed.</p>
</details>
<br>
<details>
<summary id="books">My Books</summary>
<p>You know what they say: keep your friends close and your books closer. My friends don't tell me bedtime stories but at least my books do.</p>
</details>
<br>
<details>
<summary id="cows">My Cows</summary>
<p>I have a bunch of pictures of cows doing yoga hung up around my room. Why? Maybe they are teaching me something about life... maybe they are just there to look silly and make me laugh.</p>
</details>
</section>
</body>
</html>
Also see: Tab Triggers