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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ 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

              
                .container
	header
		h1 A Clock Made Of Clocks
	.watch-container
		- for (i = 0; i < 4; i++)
			.watch-circle-container(id=`watch-circle-${i}`)
				- for(j = 0; j < 24; j++)
					span
	p.inspiration-text Inspired by&nbsp;
		a(
			href="https://twitter.com/latestengineer/status/1429761388591960065",
			target="_top"
		) this tweet
	.social-container
		a.social(href="https://twitter.com/fatihsolhann", target="_top") @fatihsolhann
		a.social(
			href="https://twitter.com/intent/tweet?text=a%20clock%20made%20of%20clocks.&url=https://codepen.io/solhan/pen/QWgwzmg&via=fatihsolhann",
			target="_top"
		) Share on twitter

              
            
!

CSS

              
                *
	margin: 0
	padding: 0
	box-sizing: border-box
:root
	--circle-x: 4
	--circle-y: 6
	--circle-size: calc((100vw / calc(var(--circle-x) * 2)) - .5rem)
	@media (min-width: 480px)
		--circle-size: 50px

body
	background: #F9FAFB
	font-family: Inter, sans-serif
.container
	display: flex
	flex-direction: column
	justify-content: center
	align-items: center
	height: 100%
	header
		display: flex
		flex-direction: column
		justify-content: center
		align-items: center
		margin: 2rem 1rem 0
	h1
		font-size: clamp(1.5rem, 4vw, 4rem)
		font-weight: 700
		color: #1F2937
	
.watch-container
	display: grid
	grid-template-columns: repeat(2, calc(var(--circle-x) * var(--circle-size)))
	grid-template-rows: repeat(2, calc(var(--circle-y) * var(--circle-size)))
	margin-top: 2rem
.watch-circle-container
	display: grid
	grid-template-columns: repeat(var(--circle-x), var(--circle-size))
	grid-template-rows: repeat(var(--circle-y), var(--circle-size))
span
	font-size: var(--circle-size)
	width: 1em
	height: 1em
	border-radius: 50%
	display: block
	position: relative
	box-shadow: inset 1px -1px 2px 1px rgb(0 0 0 / 17%)
	overflow: hidden
	&:before,
	&::after
		content: ""
		position: absolute
		left: 0
		right: 0
		margin: 0 auto
		height: calc(var(--circle-size) / 2)
		width: 3px 
		background: #1F2937
		transition: 5s
		transform-origin: bottom
	&::before
		transform: rotate(var(--angle-1))
	&::after
		transform: rotate(var(--angle-2))
.inspiration-text
	margin-top: 3rem
	margin-left: 1rem

.social
	display: flex
	align-items: center
	height: 2.5rem
	padding: 0 1rem
	background: #1DA1F2
	border-radius: 2rem
	color: white
	text-decoration: none
	&:hover
		background: #0d76b7
	&:visited
		color: white
	& + .social
		margin-left: 1rem
		@media (min-width: 480px)
			margin-left: 2rem
	&-container
		display: flex
		align-items: center
		justify-content: center
		margin: 2rem 0
		flex-shrink: 0
              
            
!

JS

              
                const digits = {
	0: [
		[90, 180],
		[90, 270],
		[90, 270],
		[180, 270],

		[0, 180],
		[90, 180],
		[180, 270],
		[0, 180],

		[0, 180],
		[0, 180],
		[0, 180],
		[0, 180],

		[0, 180],
		[0, 180],
		[0, 180],
		[0, 180],

		[0, 180],
		[0, 90],
		[0, 270],
		[0, 180],

		[0, 90],
		[90, 270],
		[90, 270],
		[0, 270]
	],
	1: [
		[90, 180],
		[90, 270],
		[180, 270],
		[225, 225],
		[0, 90],
		[180, 270],
		[180, 0],
		[225, 225],
		[225, 225],
		[180, 0],
		[180, 0],
		[225, 225],
		[225, 225],
		[180, 0],
		[180, 0],
		[225, 225],
		[90, 180],
		[270, 0],
		[0, 90],
		[180, 270],
		[90, 0],
		[90, 270],
		[270, 90],
		[0, 270]
	],
	2: [
		[180, 90],
		[90, 270],
		[90, 270],
		[270, 180],
		[0, 90],
		[90, 270],
		[270, 180],
		[180, 0],
		[180, 90],
		[270, 90],
		[0, 270],
		[180, 0],
		[0, 180],
		[180, 90],
		[270, 90],
		[270, 0],
		[180, 0],
		[0, 90],
		[270, 90],
		[180, 270],
		[0, 90],
		[270, 90],
		[270, 90],
		[270, 0]
	],
	3: [
		[180, 90],
		[90, 270],
		[90, 270],
		[270, 180],
		[0, 90],
		[90, 270],
		[270, 180],
		[180, 0],
		[180, 90],
		[270, 90],
		[0, 270],
		[180, 0],
		[90, 0],
		[270, 90],
		[180, 270],
		[180, 0],
		[90, 180],
		[270, 90],
		[0, 270],
		[180, 0],
		[0, 90],
		[270, 90],
		[270, 90],
		[270, 0]
	],
	4: [
		[180, 90],
		[180, 270],
		[225, 225],
		[225, 225],
		[0, 180],
		[180, 0],
		[225, 225],
		[225, 225],
		[0, 180],
		[180, 0],
		[180, 90],
		[180, 270],
		[0, 180],
		[0, 90],
		[0, 270],
		[180, 0],
		[0, 90],
		[270, 90],
		[180, 270],
		[180, 0],
		[225, 225],
		[225, 225],
		[0, 90],
		[270, 0]
	],
	5: [
		[180, 90],
		[90, 270],
		[90, 270],
		[270, 180],
		[180, 0],
		[180, 90],
		[90, 270],
		[270, 0],
		[0, 180],
		[0, 90],
		[90, 270],
		[270, 180],
		[0, 90],
		[90, 270],
		[270, 180],
		[180, 0],
		[180, 90],
		[270, 90],
		[0, 270],
		[180, 0],
		[0, 90],
		[270, 90],
		[270, 90],
		[270, 0]
	],
	6: [
		[180, 90],
		[90, 270],
		[90, 270],
		[270, 180],
		[0, 180],
		[90, 180],
		[270, 90],
		[0, 270],
		[180, 0],
		[0, 90],
		[270, 90],
		[180, 270],
		[180, 0],
		[90, 180],
		[270, 180],
		[0, 180],
		[0, 180],
		[0, 90],
		[270, 0],
		[180, 0],
		[0, 90],
		[270, 90],
		[270, 90],
		[270, 0]
	],
	7: [
		[180, 90],
		[270, 90],
		[270, 90],
		[270, 180],
		[90, 0],
		[270, 90],
		[270, 225],
		[225, 0],
		[225, 225],
		[45, 180],
		[45, 180],
		[225, 225],
		[225, 225],
		[0, 180],
		[0, 180],
		[225, 225],
		[225, 225],
		[0, 180],
		[0, 180],
		[225, 225],
		[225, 225],
		[0, 90],
		[0, 270],
		[225, 225]
	],
	8: [
		[180, 90],
		[90, 270],
		[90, 270],
		[270, 180],
		[180, 0],
		[90, 180],
		[270, 180],
		[180, 0],
		[180, 0],
		[90, 0],
		[0, 270],
		[180, 0],
		[0, 180],
		[180, 90],
		[180, 270],
		[0, 180],
		[180, 0],
		[90, 0],
		[270, 0],
		[180, 0],
		[0, 90],
		[90, 270],
		[270, 90],
		[270, 0]
	],
	9: [
		[180, 90],
		[90, 270],
		[90, 270],
		[270, 180],
		[0, 180],
		[90, 180],
		[270, 180],
		[180, 0],
		[180, 0],
		[0, 90],
		[0, 270],
		[180, 0],
		[0, 90],
		[90, 270],
		[180, 270],
		[0, 180],
		[90, 180],
		[90, 270],
		[0, 270],
		[180, 0],
		[0, 90],
		[270, 90],
		[270, 90],
		[270, 0]
	]
};

const set = (el, value) => {
	const spans = el.querySelectorAll("span");
	spans.forEach((span, index) => {
		span.style.setProperty("--angle-1", `${value[index][0]}deg`);
		span.style.setProperty("--angle-2", `${value[index][1]}deg`);
	});
};
setInterval(() => {
	const date = new Date();
	const [h1, h2] = date.getHours().toString().padStart(2, "0");
	const [m1, m2] = date.getMinutes().toString().padStart(2, "0");
	const time = [h1, h2, m1, m2];
	for (let i = 0; i < time.length; i++) {
		set(document.querySelector(`#watch-circle-${i}`), digits[time[i]]);
	}
}, 100);

              
            
!
999px

Console