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.
<svg width="500px" height="500px" viewBox="0 0 500 500" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<path id="circleBottom" d="M100 251C100 334 167 401 250 401 333 401 400 334 400 251"/>
</defs>
<text font-family="Montserrat, sans-serif" font-size="18" font-weight="400" fill="white" letter-spacing="4" textLength="145" style="text-shadow: 0 2px 15px rgba(0,0,0,.3)">
<textPath xlink:href="#circleBottom" text-anchor="middle" startOffset="50%">SINCE 1973</textPath>
</text>
<!-- Rings & Bottle: -->
<g stroke="white" fill="none">
<path stroke-width="2.25" d="M322 371L322 371 322 371C364 347 391 302 391 251 391 173 328 110 251 110 173 110 110 173 110 251 110 302 138 347 179 371"/>
<path stroke-width="3.5" d="M327 379L327 379 327 379C371 353 401 305 401 251 401 168 333 101 251 101 168 101 101 168 101 251 101 305 130 353 174 379"/>
</g>
<path d="M227.6 167.3C224.5 168.7 223.4 171.9 223.2 176.4L223.1 182.6C224.6 182 234.2 180.1 250 180.1 265.8 180.1 275.4 182 276.9 182.6L276.8 176.4C276.6 171.9 275.9 168.2 272.4 167.3 265.8 165.7 259.5 165 250 165 241.2 165 231.7 165.7 227.6 167.3ZM225.2 186.4C222.4 187.1 220.4 188.5 220.4 191.9 220.4 195.4 222.4 197.5 225.2 197.7 225.2 208.9 219.4 216.8 213.2 227.6 207 238.3 200 250.2 200 275.7 200 309.8 201.2 313.7 204.8 321.1 208.3 328.4 213.9 333 250 333 286.1 333 291.7 328.4 295.2 321.1 298.8 313.7 300 309.8 300 275.7 300 250.2 293 238.3 286.8 227.6 280.6 216.8 274.8 208.9 274.8 197.7 277.6 197.5 279.6 195.4 279.6 191.9 279.6 188.5 277.6 187.1 274.8 186.4 272 185.7 264.8 184.5 250 184.5 235.2 184.5 228 185.7 225.2 186.4Z" fill="white"/>
<!-- Bottle icon by Peter Nowell Design, all rights reserved. -->
</svg>
<!--
HELPFUL NOTES:
- Your path must actually be a <path> element, not a <circle> or other preset shape
- The path can be within the <defs> area if you don't want it to be visible (like I've done)
- You can center-align the text by using text-anchor="middle" along with startOffset="50%" on the <textPath> element
- Letter-Spacing sometimes has inconsistent results, and is not supported on SVG elements in Firefox. To compensate, I've added the textLength attribute with a manually-defined length. Somehow only Firefox seems to recognize textLength when on the <text> element, which allows it to be a quasi-solution to FF's lack of letter-spacing support.
-->
svg {
width: 80vw;
height: 80vw;
background: no-repeat url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/44800/succulent-plants.jpg") #2D493C;
background-size: cover;
}
/* Photo from Unslpash. Photo could be inside the SVG too. */
Also see: Tab Triggers