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.
<div class="wrapper">
<div class="vertical-line"></div>
<div class="horizontal-line"></div>
<svg class="obytes" width="30" height="45" xmlns="http://www.w3.org/2000/svg"><g fill-rule="nonzero" fill="none"><path d="M14.297 42.889c-6.729.03-12.485-4.884-13.587-11.6-1.102-6.716 2.776-13.249 9.154-15.42a.874.874 0 0 1 .687.034.89.89 0 0 1 .455.521.928.928 0 0 1-.563 1.172c-5.507 1.913-8.84 7.573-7.882 13.384.96 5.81 5.929 10.069 11.751 10.069 5.823 0 10.792-4.259 11.75-10.07.96-5.81-2.374-11.47-7.88-13.383-.488-.185-11.243-4.239-11.243-10.204.007-.278.129-.54.335-.724.137-.108 3.138-2.466 9.003 2.22C17.344 6.066 20.193-.13 25.662.594a.904.904 0 0 1 .761.77c.46 4.774-1.719 9.415-5.667 12.07a.907.907 0 0 1-1.264-.201.918.918 0 0 1 .213-1.28c3.142-2.15 5.011-5.749 4.982-9.587-4.83.077-7.069 8.185-7.084 8.277a.95.95 0 0 1-.625.632.906.906 0 0 1-.853-.185c-4.068-3.576-6.398-3.421-7.328-3.16.625 3.684 7.328 6.952 9.979 7.938 6.386 2.174 10.265 8.72 9.15 15.443-1.114 6.723-6.892 11.63-13.63 11.577" fill="#FD7D4B"></path><path d="M25.327 29.079c0 6.152-4.929 11.14-11.01 11.143-6.08.003-11.014-4.98-11.02-11.133-.005-6.153 4.919-11.146 11-11.154 6.083 0 11.014 4.99 11.014 11.144" fill="#FD7D4B"></path><path d="M24.854 29.079c0 5.888-4.717 10.663-10.537 10.666-5.82.002-10.541-4.767-10.547-10.656C3.764 23.2 8.477 18.42 14.297 18.413a10.465 10.465 0 0 1 7.459 3.12 10.714 10.714 0 0 1 3.083 7.546" fill="#FFF"></path><path d="M14.16 28.154h.472l3.047-8.03a.465.465 0 0 0-.168-.57 9.884 9.884 0 0 0-6.413 0s-.427.261-.244.616L13.9 28.2a.18.18 0 0 0 .152 0M14.876 28.339l.274.277h.107l7.815-3.452a.464.464 0 0 0 .274-.524 9.961 9.961 0 0 0-4.57-4.624s-.488-.124-.61.262L14.8 28.169c0 .06.029.117.076.154M15.257 28.955v.494l7.937 3.082c.199.088.431.016.548-.17a10.177 10.177 0 0 0 0-6.488s-.259-.432-.624-.262l-7.922 3.082a.171.171 0 0 0 0 .139M15.12 29.68l-.275.277v.123l3.413 7.892a.456.456 0 0 0 .518.293 10.145 10.145 0 0 0 4.57-4.624s.122-.493-.259-.632l-7.83-3.39a.18.18 0 0 0-.137 0M14.45 29.988h-.397l-.091.077-3.047 8.03s-.152.278.183.555a9.779 9.779 0 0 0 6.398 0s.427-.262.26-.632l-3.048-8.015a.196.196 0 0 0-.152 0M13.748 29.88l-.274-.277h-.122l-7.8 3.498a.464.464 0 0 0-.274.525 10.038 10.038 0 0 0 4.57 4.624s.488.107.61-.263l3.412-7.891a.171.171 0 0 0 0-.154M13.368 29.294v-.385l-.077-.092-7.937-3.083a.454.454 0 0 0-.563.17 10.224 10.224 0 0 0 0 6.488s.259.432.624.247l7.922-3.083a.171.171 0 0 0 0-.154M13.505 28.57l.274-.231v-.108l-3.397-7.953A.471.471 0 0 0 9.864 20a9.961 9.961 0 0 0-4.57 4.624s-.123.493.243.617l7.815 3.406a.197.197 0 0 0 .153-.077M10.275 17.657l-.868-1.649a30.073 30.073 0 0 1 4.89-1.387l4.723 3.314a11.71 11.71 0 0 0-8.76-.278" fill="#FD7D4B"></path></g></svg>
</div>
.wrapper {
border: 1px solid;
position: absolute;
width: 500px;
height: 500px;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: #fff;
border-radius: 50%;
}
.wrapper svg {
position: absolute;
top: calc(50% - (45px / 2));
left: calc(50% - (30px / 2));
transform: translate(-50%, -50%);
transform-origin: center center;
}
.vertical-line {
width: 100%;
position: absolute;
height: 1px;
background-color: rgb(216, 216, 216);
top: 50%;
left: 0;
}
.horizontal-line {
height: 100%;
position: absolute;
width: 1px;
background-color: rgb(216, 216, 216);
top: 0%;
left: 50%;
}
let ANGLE = 0;
let PREV_LEFT = 0;
let PREV_TOP = 0;
function rotate() {
const ObytesLogo = document.getElementsByClassName("obytes")[0];
const radius = 200;
const X = radius * Math.cos((ANGLE * Math.PI) / 180);
const Y = radius * Math.sin((ANGLE * Math.PI) / 180);
ObytesLogo.style.transform = `translate(${X}px, ${Y}px)`;
ANGLE = ANGLE + 1;
requestAnimationFrame(rotate);
}
document.addEventListener("DOMContentLoaded", () => {
requestAnimationFrame(() => {
rotate();
});
});
Also see: Tab Triggers