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 id="sunburst">
<!-- dashes -->
<section class="dashes"></section>
<!-- outer colour -->
<section class="circle"></section><!--2-->
<section class="circle"></section>
<section class="circle"></section>
<section class="circle"></section>
<section class="circle"></section>
<section class="circle"></section>
<!--mid colour -->
<section class="circle"></section><!--8-->
<section class="circle"></section>
<section class="detail"></section><!--10-->
<section class="circle"></section>
<section class="circle"></section>
<!-- inner colour -->
<section class="circle"></section><!--13-->
<section class="circle"></section>
<section class="circle"></section>
<section class="circle"></section>
<section class="circle"></section>
<section class="circle"></section>
<section class="circle"></section>
<section class="burst"></section><!--20-->
<section class="burst"></section>
</div>
/* settings */
body {
--black: #222;
--pink: #E52F70;
--bk: oldlace;
--col1: darkkhaki;
--col2: indianred;
--col3: lightseagreen;
--detail: darkgray;
background-color: var(--bk);
}
/* container */
#sunburst {
border-radius: 50%;
width: 90vmin; height: 90vmin;
margin: 5vmin auto;
display: grid;
grid-template-areas: "chart";
place-items: center;
}
/* all sections */
section {
grid-area: chart;
border-radius: 50%;
background-repeat: no-repeat;
background-position: center;
}
/* counts down for each section, means inner is first here */
.circle:nth-of-type(19) {
width: 18vmin; height: 18vmin;
border: 1px solid var(--bk);
background-image:
radial-gradient(circle at center, var(--bk) 70%, transparent 70%),
conic-gradient(
var(--bk) 36deg,
var(--col1) 36deg 110deg, var(--bk) 110deg
)
;
background-size: 15vmin 15vmin, 18vmin 18vmin;
}
.circle:nth-of-type(18) {
width: 21vmin; height: 21vmin;
background-image:
conic-gradient(
var(--bk) 70deg,
var(--col1) 70deg 250deg, var(--bk) 250deg
)
;
}
.circle:nth-of-type(17) {
width: 24vmin; height: 24vmin;
background-image:
conic-gradient(
var(--bk) 190deg,
var(--col1) 190deg 250deg, var(--bk) 250deg
)
;
}
.circle:nth-of-type(16) {
width: 27vmin; height: 27vmin;
background-image:
conic-gradient(
var(--bk) 46deg,
var(--col1) 46deg 120deg, var(--bk) 120deg 220deg,
var(--col1) 220deg 260deg, var(--bk) 260deg
)
;
}
.circle:nth-of-type(15) {
width: 30vmin; height: 30vmin;
border: 1px solid var(--bk);
background-image:
conic-gradient(
var(--bk) 180deg,
var(--col1) 180deg 290deg, var(--bk) 290deg
)
;
}
.circle:nth-of-type(14) {
width: 33vmin; height: 33vmin;
background-image:
conic-gradient(
var(--bk) 210deg,
var(--col1) 210deg 290deg, var(--bk) 290deg
)
;
}
.circle:nth-of-type(13) {
width: 39vmin; height: 39vmin;
border: 2px solid var(--detail);
background-image:
conic-gradient(
var(--bk) 280deg,
var(--col1) 280deg 290deg, var(--bk) 290deg
)
;
}
/* second group */
.circle:nth-of-type(12) {
width: 42vmin; height: 42vmin;
background-image:
conic-gradient(
var(--bk) 160deg,
var(--col2) 160deg 360deg, var(--bk) 360deg
)
;
}
.circle:nth-of-type(11) {
width: 48vmin; height: 48vmin;
border: 1px solid var(--bk);
background-image:
conic-gradient(
var(--bk) 200deg,
var(--col2) 200deg 360deg, var(--bk) 360deg
)
;
}
.detail:nth-of-type(10) {
width: 52vmin; height: 32vmin;
border: 2px solid var(--detail);
}
.circle:nth-of-type(9) {
width: 51vmin; height: 51vmin;
background-image:
conic-gradient(
var(--bk) 300deg,
var(--col2) 300deg 360deg, var(--bk) 360deg
)
;
}
.circle:nth-of-type(8) {
width: 57vmin; height: 57vmin;
border: 1px solid var(--bk);
background-image:
conic-gradient(
var(--bk) 320deg,
var(--col2) 320deg 360deg, var(--bk) 360deg
)
;
}
/* outer part */
.circle:nth-of-type(7) {
width: 60vmin; height: 60vmin;
background-image:
conic-gradient(
var(--bk) 190deg,
var(--col3) 190deg 360deg, var(--bk) 360deg
)
;
}
.circle:nth-of-type(6) {
width: 66vmin; height: 66vmin;
border: 1px solid var(--detail);
background-image:
conic-gradient(
var(--bk) 290deg,
var(--col3) 290deg 360deg, var(--bk) 360deg
)
;
}
.circle:nth-of-type(5) {
width: 72vmin; height: 72vmin;
border: 1px solid var(--bk);
background-image:
conic-gradient(
var(--bk) 330deg,
var(--col3) 330deg 360deg, var(--bk) 360deg
)
;
}
.circle:nth-of-type(4) {
width: 75vmin; height: 75vmin;
border: 1px solid var(--bk);
background-image:
conic-gradient(
var(--bk) 240deg,
var(--col3) 240deg 360deg, var(--bk) 360deg
)
;
}
.circle:nth-of-type(3) {
width: 78vmin; height:78vmin;
background-image:
conic-gradient(
var(--bk) 310deg,
var(--col3) 310deg 360deg, var(--bk) 360deg
)
;
}
.circle:nth-of-type(2) {
width: 84vmin; height: 84vmin;
border: 1px solid var(--bk);
background-image:
conic-gradient(
var(--bk) 340deg,
var(--col3) 340deg 360deg, var(--bk) 360deg
)
;
}
.dashes {
width: 90vmin; height: 90vmin;
background-image:
conic-gradient(
var(--detail) 0 2deg, var(--bk) 2deg 30deg,
var(--detail) 30deg 32deg, var(--bk) 32deg 60deg,
var(--detail) 60deg 61deg, var(--bk) 61deg 90deg,
var(--detail) 90deg 92deg, var(--bk) 92deg 120deg,
var(--detail) 120deg 122deg, var(--bk) 122deg 150deg,
var(--detail) 150deg 151deg, var(--bk) 151deg 180deg,
var(--detail) 180deg 182deg, var(--bk) 182deg 210deg,
var(--detail) 210deg 211deg, var(--bk) 211deg 240deg,
var(--detail) 240deg 241deg, var(--bk) 241deg 270deg,
var(--detail) 270deg 272deg, var(--bk) 272deg 300deg,
var(--detail) 300deg 301deg, var(--bk) 301deg 330deg,
var(--detail) 330deg 331deg, var(--bk) 331deg 360deg,
)
;
background-size: 90vmin;
}
.burst:nth-of-type(20) {
width: 62vmin; height: 62vmin;
background-image:
radial-gradient(circle at center, var(--bk) 50%, transparent 50%),
conic-gradient(
transparent 6deg,
var(--detail) 6deg 12deg, transparent 12deg 158deg,
var(--detail) 158deg 164deg, transparent 164deg 296deg,
var(--detail) 296deg 302deg, transparent 302deg
)
;
background-size: 15vmin 15vmin, 62vmin 62vmin;
opacity: 0.7;
}
.burst:nth-of-type(21) {
width: 82vmin; height: 82vmin;
background-image:
radial-gradient(circle at center, var(--bk) 50%, transparent 50%),
conic-gradient(
transparent 26deg,
var(--detail) 26deg 32deg, transparent 32deg 100deg,
var(--detail) 100deg 106deg, transparent 106deg 246deg,
var(--detail) 246deg 252deg, transparent 252deg
)
;
background-size: 15vmin 15vmin, 82vmin 82vmin;
opacity: 0.7;
}
Also see: Tab Triggers