Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's 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 it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

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.

+ add another resource

Packages

Add Packages

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.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <p class="initial">Find the paint worklet <a href="https://github.com/nachtfunke/drawn-line-paint-worklet" target="_blank">on Github</a>.</p>

<figure class="example">
	<div class="example__area">
		<ul class="link-list">
			<li><a href="#">Home</a></li>
			<li><a href="#">Link A</a></li>
			<li><a href="#">Link B</a></li>
			<li><a href="#">Link C</a></li>
		</ul>
	</div>
	<figcaption class="example__caption">Paintlet as border-image. Hover for a cute animation!</figcaption>
</figure>

<figure class="example">
	<div class="example__area">
		<p>Jelly jelly beans marzipan lemon drops caramels. Bonbon pudding fruitcake chocolate cake cupcake. Tiramisu pudding dragée brownie oat cake tootsie roll marzipan shortbread bonbon. Lollipop gingerbread cake cotton candy ice cream dessert candy canes muffin caramels.</p>
		<hr class="aggro-squiggle">
		<p>Halvah toffee toffee caramels candy. Tootsie roll cupcake jelly-o gummies liquorice gingerbread halvah jujubes. Powder pie chocolate cake gingerbread cookie gummies jelly. Croissant chupa chups halvah caramels sesame snaps marshmallow croissant cupcake apple pie. Marshmallow croissant dessert oat cake croissant.</p>
	</div>
	<figcaption class="example__caption">An... angry (?) horizontal rule</figcaption>
</figure>

<figure class="example">
	<div class="example__area">
		<ul class="planet-lines">
			<li>Mercury</li>
			<li>Venus</li>
			<li>Moon</li>
			<li>Mars</li>
			<li>Jupiter</li>
			<li>Saturn</li>
			<li>Uranus</li>
			<li>Neptune</li>
			<li>Pluto</li>
		</ul>
	</div>
	<figcaption class="example__caption">An assortment of various possible lines</figcaption>
</figure>

<footer>
	by <a href="https://helloyes.dev/" target="_blank">Thomas Michael Semmler</a> - <a href="https://twitter.com/nachtfunke" target="_blank">@nachtfunke</a>
</footer>


<script>
	CSS.registerProperty({
        name: '--drawn-line-color',
        syntax: '<color>',
        inherits: false,
        initialValue: 'black'
    });
    CSS.registerProperty({
        name: '--drawn-line-strength',
        syntax: '<length>',
        inherits: false,
        initialValue: '2px'
    });
    CSS.registerProperty({
        name: '--drawn-line-curve-range',
        syntax: '<length>',
        inherits: false,
        initialValue: '1px'
    });
    CSS.registerProperty({
        name: '--drawn-line-segment-size',
        syntax: '<length>',
        inherits: false,
        initialValue: '12px'
    });
    CSS.registerProperty({
        name: '--drawn-line-wiggle',
        syntax: '<integer>',
        inherits: false,
        initialValue: '1'
    });
	CSS.paintWorklet.addModule('https://unpkg.com/drawn-line-paint-worklet@1.0.3/dist/worklet.js');
</script>
              
            
!

CSS

              
                body {
	padding: clamp(2em, 7vmin, 5em);
	font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;
}

p {
	line-height: 1.5;
}

.initial {
	text-align: center;
	margin-block-end: clamp(2em, 7vmax, 5em);
}

.footer {
	text-align: center;
	margin-block-start: clamp(2em, 7vmax, 5em);
}

.example {
	padding: 2em;
	display: flex;
	flex-direction: column;
	gap: 2em;
	border-radius: 3px;
	background-color: rgb(0 0 0 / 4%);

	&__area {
		
	}
	
	&__caption {
		font-style: italic;
		font-size: .9em;
		line-height: 1.5;
	}
	
	& + & {
		margin-top: 2.5em;
	}
}

@property --underline-offset {
	syntax: '<length>';
	inherits: false;
	initial-value: 3px;
}

@keyframes redrawLine {
	to { border-image-source: paint(drawn-line); }
}

.link-list {
	display: flex;
	gap: 1em;
	
	li {
		--underline-offset: 6px;
		--link-color-hs: 292 78%;
		--link-color-line: hsl(var(--link-color-hs) 30%);
		--drawn-line-strength: .35ex;
		--drawn-line-color: var(--link-color-line);
		color: hsl(var(--link-color-hs) 15%);
		border-style: solid;
		border-bottom-width: var(--underline-offset);
		border-image-slice: 0 fill;
		border-image-outset: 0 0 var(--underline-offset);
		border-image-source: paint(drawn-line);
		display: inline-block;

		&:hover {
			--link-color-hs: 200 85%;
			animation: redrawLine 750ms steps(2) infinite alternate;

		}
		
		> a {
			color: inherit;
			text-decoration: none;
		}
	}
}

.aggro-squiggle {
	--drawn-line-strength: 4px;
	--drawn-line-curve-range: 4px;
	--drawn-line-wiggle: 8;
	--drawn-line-color: salmon;
	background-image: paint(drawn-line);
	border: none;
	height: calc(var(--drawn-line-strength) + (var(--drawn-line-curve-range) * 2) * 1.5);
}

.planet-lines {
	li {
		color: transparent;
		background-image: paint(drawn-line);
		
		&:nth-child(1) {
			--drawn-line-color: #9DE4F8;
			--drawn-line-segment-size: 40px;
		}
		
		&:nth-child(2) {
			--drawn-line-color: #F8AD2D;
			--drawn-line-strength: 4px;
			--drawn-line-curve-range: 2.5px;
			--drawn-line-segment-size: 20px;
		}
		
		&:nth-child(3) {
			--drawn-line-color: hotpink;
			--drawn-line-strength: .5em;
			--drawn-line-curve-range: 5px;
			--drawn-line-segment-size: 100px;
			height: 1.5em;
		}

		&:nth-child(4) {
			--drawn-line-color: #D60015;
			--drawn-line-strength: 1px;
			--drawn-line-wiggle: 10;
		}
		
		&:nth-child(5) {
			--drawn-line-color: #2FCF55;
			--drawn-line-strength: 5px;
			--drawn-line-curve-range: 5px;
			--drawn-line-wiggle: 5;
			--drawn-line-segment-size: 50px;
		}
		
		&:nth-child(6) {
			--drawn-line-color: #47427A;
			--drawn-line-strength: 3px;
			--drawn-line-curve-range: 5px;
			--drawn-line-wiggle: 5;
			--drawn-line-segment-size: 5px;
		}
		
		&:nth-child(7) {
			--drawn-line-color: #FBCA49;
			--drawn-line-strength: 8px;
			--drawn-line-curve-range: 5px;
			--drawn-line-wiggle: 5;
			--drawn-line-segment-size: 5px;
			height: 2em;
		}
		
		&:nth-child(8) {
			--drawn-line-color: #268785;
			--drawn-line-strength: 2px;
			--drawn-line-wiggle: 20;
			--drawn-line-segment-size: 5px;
		}
		
		&:nth-child(9) {
			--drawn-line-color: #69002A;
			--drawn-line-strength: 1px;
			--drawn-line-curve-range: 1em;
			--drawn-line-segment-size: 100px;
			height: 2em;
		}
	}
}
              
            
!

JS

              
                
              
            
!
999px

Console