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 Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
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">
<svg id="illy" viewBox="0 0 100 100" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M76.9613 93.0186C77.4387 92.0766 78.4925 90.799 79.3327 90.0898C80.2265 89.336 81.5814 89.196 82.266 88.2712C83.2662 86.9246 83.0908 82.9819 83.0026 81.3125C82.8589 78.5938 80.3202 77.3408 79.1099 75.1176C77.9542 72.9935 77.2914 69.9565 76.5912 67.6142C75.872 65.2083 75.0455 62.7568 74.7727 60.3027C74.4435 57.4103 75.3282 54.5333 75.3182 51.4827C75.3028 44.4812 75.8638 37.4352 75.8638 30.3474C75.8638 28.0988 76.7658 8.80567 70.9837 11.3435C71.1528 11.0771 71.1146 10.7406 71.2674 10.4578C68.0131 8.7302 68.5095 5.40042 66.13 3.13813C65.4753 2.51528 64.1777 2.20885 63.4021 1.63964C62.6983 1.12772 62.1382 0.415751 61.389 0.213891C58.9812 -0.436244 54.4785 0.590333 51.787 0.725815C45.6039 1.0377 38.4379 1.94152 32.824 4.70028C29.8134 6.17967 26.4472 7.05258 23.5039 8.77203C21.4462 9.97319 19.6712 11.469 17.6981 12.7929C15.9887 13.9395 13.8791 14.9215 13.6782 16.7891C13.4754 18.6741 14.442 21.4074 14.6402 23.3614C14.8521 25.4355 14.9875 27.4905 15.0039 29.58C15.0348 32.9052 14.4729 37.0879 15.3103 40.2322C16.7452 45.6142 20.1914 50.2824 22.6382 55.1926C23.7039 57.3348 24.9169 59.4662 26.6818 61.1638C28.5813 62.9923 30.769 64.3008 32.4857 66.2739C38.0723 72.7007 44.1963 79.1975 51.2496 84.0676C54.3675 86.2208 57.6427 87.0364 61.2644 87.8111C63.2776 88.2421 66.3246 90.6981 68.3632 88.8886C70.1872 89.637 71.9548 90.5699 73.6724 91.3691C74.819 91.9029 76.4276 92.0893 76.9613 93.0186Z" fill="#121567" />
<image xlink:href="https://res.cloudinary.com/makingthings/image/upload/v1648148097/quirkycode/table-full.jpg" width="100" height="100" fill="#519AF6" clip-path="url(#table-top)" />
<image width="100%" height="100%" xlink:href="https://res.cloudinary.com/makingthings/image/upload/v1648134367/quirkycode/leaf.png" transform="translate(0,0)" />
<clipPath id="table-top">
<path d="M19.0705 10.5434C19.7129 9.93672 20.8944 9.39311 21.4534 8.65514C21.8409 7.88023 22.8612 6.93928 23.7017 6.80997C25.0681 6.59975 26.1542 6.48739 27.5009 6.05452C28.3675 5.77596 29.2803 5.47928 30.1176 5.11295C31.6069 4.46136 33.1364 4.21968 34.6284 3.64585C35.8301 3.18366 37.0881 3.22854 38.3399 3.01083C39.2907 2.84548 40.4024 2.31841 41.3398 2.26634C42.0633 2.22614 42.7517 1.82405 43.4091 1.47804C44.3466 0.984584 45.7233 0.800413 46.7703 0.700698C48.3883 0.546599 49.9993 0.492676 51.6314 0.492676C53.2849 0.492676 55.0172 0.886822 56.7115 0.886822C58.445 0.886822 60.6081 1.17979 62.2296 1.82839C62.8371 2.07142 63.2155 1.77439 63.7076 2.37582C64.1595 2.92809 64.7384 3.80046 65.2842 4.23707C65.8477 4.68785 66.2147 5.49356 66.7623 6.01073C67.1576 6.38413 68.106 6.74676 68.1418 7.39024C68.2155 8.71713 68.7335 9.59126 69.8169 10.4339C70.2656 10.7829 71.0063 10.3443 71.492 10.5872C71.8031 10.7427 72.1864 11.2979 72.4336 11.5726C73.1361 12.3531 72.8715 14.0048 72.8715 14.9776C72.8715 15.7686 73.013 16.085 72.6307 16.8498C72.3379 17.4353 71.9312 17.976 71.5358 18.4701C70.7636 19.4354 69.4484 20.7612 68.0432 20.9773C66.8369 21.1629 66.5728 20.9807 65.6236 21.9299C64.8808 22.6727 64.3275 22.7636 63.412 23.1123C63.0113 23.265 62.5364 23.0914 62.1201 23.167C61.7101 23.2416 61.3549 23.4996 60.9376 23.5393C59.5334 23.673 58.4852 22.9483 58.4852 24.8203C58.4852 25.4142 58.7165 26.5474 58.4414 27.0976C58.29 27.4003 57.5933 28.3679 57.3027 28.5209C56.6202 28.8801 55.8481 29.3063 55.1349 29.561C54.3705 29.834 54.1792 29.6595 53.4489 29.6595C52.2001 29.6595 50.5765 29.3152 49.376 28.915C48.5861 28.6517 47.9158 28.0198 47.0549 27.8968C46.6031 27.8323 45.6754 28.1064 45.6754 27.3932C45.6754 26.5328 43.7803 27.6311 43.4638 27.8421C43.255 27.9813 41.48 27.3378 41.1865 27.2508C39.9919 26.8969 38.4061 26.901 37.5078 26.0027C36.4799 24.9748 35.9333 23.4785 34.6831 22.5649C34.1413 22.169 31.9112 19.2517 31.2891 19.7183C30.7684 20.1088 30.1151 19.3315 29.6687 19.1708C28.877 18.8858 28.4854 18.7782 27.6542 18.9738C26.4378 19.26 25.1107 18.9563 23.8988 19.2256C22.6119 19.5116 21.4142 19.2765 20.4062 18.4701C19.6318 17.8505 17.8875 17.637 17.3954 16.7512C16.9092 15.876 16.6562 14.6685 16.3553 13.6528C16.0055 12.4723 17.0394 11.7348 17.7896 11.1346C18.1734 10.8275 18.7287 10.8662 19.0705 10.5434Z" stroke="white" stroke-width="0.29561" stroke-linecap="round" />
</clipPath>
</svg>
</div>
html {
--color-light: #519af6;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html,
body {
height: 100%;
background-color: var(--color-light);
}
.wrapper {
min-height: 100vh;
max-width: 50vw;
display: grid;
place-items: center;
margin: 0 auto;
& svg{
background-color: #fff;
}
}
const draw = SVG("#illy");
const path = draw.path("M20,20 Q40,30 45,50 T60 80");
var linear = draw.gradient("linear", function (add) {
add.stop(0, "#f06");
add.stop(1, "#0f9");
});
path.stroke({ color: linear, width: 6, lineCap: "round" });
path.marker("start", 20, 20, function (add) {
add.ellipse(0.5, 1).center(10, 10);
this.fill(linear);
});
let pos;
const randomPos = () => {
pos = gsap.utils.random(30, 100);
};
randomPos();
const tl = gsap.timeline({ defaults: { duration: 3 } });
const width = gsap.getProperty(path.node, "d");
console.log(width);
tl.to(path.node, {
attr: { d: `M${pos},20 Q10,60 45,50 T60 80`, onComplete: randomPos() },
yoyo: true,
repeat: -1
});
Also see: Tab Triggers