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.
<header>
<h1>Galaxy Cluster Abell 520</h1>
</header>
<section>
<p>It was the result no one wanted to believe. Astronomers observed what appeared to be a clump of dark matter left behind during a bizarre wreck between massive clusters of galaxies.</p>
<p>The dark matter collected into a "dark core" containing far fewer galaxies than would be expected if the dark matter and galaxies hung together. Most of the galaxies apparently have sailed far away from the collision. This result could present a challenge to basic theories of dark matter, which predict that galaxies should be anchored to the invisible substance, even during the shock of a collision.</p>
<p>The initial observations, made in 2007, were so unusual that astronomers shrugged them off as unreal, due to poor data. However, new results from NASA's Hubble Space Telescope confirm that dark matter and galaxies parted ways in the gigantic merging galaxy cluster called Abell 520, located 2.4 billion light-years away.</p>
<p>Now, astronomers are left with the challenge of trying to explain dark matter's seemingly oddball behavior in this cluster.</p>
<p>"This result is a puzzle," said astronomer James Jee of the University of California, Davis, leader of the Hubble study. "Dark matter is not behaving as predicted, and it's not obviously clear what is going on. Theories of galaxy formation and dark matter must explain what we are seeing."</p>
<p>A paper reporting the team's results has been accepted for publication in The Astrophysical Journal and is available online.</p>
<p>First detected about 80 years ago, dark matter is thought to be the gravitational "glue" that holds galaxies together. The mysterious invisible substance is not made of the same kind of matter that makes up stars, planets, and people. Astronomers know little about dark matter, yet it accounts for most of the universe's mass.</p>
<p>They have deduced dark matter's existence by observing its ghostly gravitational influence on normal matter. It's like hearing the music but not seeing the band.</p>
<p>One way to study dark matter is by analyzing smashups between galaxy clusters, the largest structures in the universe. When galaxy clusters collide, astronomers expect galaxies to tag along with the dark matter, like a dog on a leash. Clouds of intergalactic gas, however, plow into one another, slow down, and lag behind the impact.</p>
<p>That theory was supported by visible-light and X-ray observations of a colossal collision between two galaxy clusters called the Bullet Cluster. The galactic grouping has become a textbook example of how dark matter should behave.</p>
<p>But studies of Abell 520 showed that dark matter's behavior may not be so simple. The original observations found that the system's core was rich in dark matter and hot gas but contained no luminous galaxies, which normally would be seen in the same location as the dark matter. NASA's Chandra X-ray Observatory detected the hot gas. Astronomers used the Canada-France-Hawaii and Subaru telescopes atop Mauna Kea to infer the location of dark matter by measuring how the mysterious substance bends light from more distant background galaxies, an effect called gravitational lensing.</p>
<p>The astronomers then turned Hubble's Wide Field Planetary Camera 2 to help bail them out of this cosmic conundrum. Instead, to their chagrin, the Hubble observations helped confirm the earlier findings. Astronomers used Hubble to map the dark matter in the cluster through the gravitational lensing technique.</p>
<p>"Observations like those of Abell 520 are humbling in the sense that in spite of all the leaps and bounds in our understanding, every now and then, we are stopped cold," explained Arif Babul of the University of Victoria in British Columbia, the team's senior theorist.</p>
<p>Is Abell 520 an oddball, or is the prevailing picture of dark matter flawed? Jee thinks it's too soon to tell.</p>
<p>"We know of maybe six examples of high-speed galaxy cluster collisions where the dark matter has been mapped," Jee said. "But the Bullet Cluster and Abell 520 are the two that show the clearest evidence of recent mergers, and they are inconsistent with each other. No single theory explains the different behavior of dark matter in those two collisions. We need more examples."</p>
<p>The team has proposed a half-dozen explanations for the findings, but each is unsettling for astronomers. "It's pick your poison," said team member Andisheh Mahdavi of San Francisco State University in California, who led the original Abell 520 observations in 2007. One possible explanation for the discrepancy is that Abell 520 was a more complicated interaction than the Bullet Cluster encounter. Abell 520 may have formed from a collision between three galaxy clusters, instead of just two colliding systems in the case of the Bullet Cluster.</p>
<p>Another scenario is that some dark matter may be what astronomers call "sticky." Like two snowballs smashing together, normal matter slams into each other during a collision and slows down. But dark matter blobs are thought to pass through each other during an encounter without slowing down. This scenario proposes that some dark matter interacts with itself and stays behind when galaxy clusters collide.</p>
<p>A third possibility is that the core contained many galaxies, but they were too dim to be seen, even by Hubble. Those galaxies would have to have formed dramatically fewer stars than other normal galaxies. Armed with the Hubble data, the group hopes to create a computer simulation to try to reconstruct the collision, hoping that it yields some answers to dark matter's weird behavior.</p>
<p><em>From http://hubblesite.org/newscenter/archive/releases/2012/10/full/</em></p>
</section>
@import "compass/css3";
$p: 10%;
$c: rgba(silver, .2);
$covered: 25vh;
$bg-size: 20vh;
$a: -15deg;
$easeInOutBack: cubic-bezier(.68, -.55, .265, 1.55);
* { margin: 0; }
html {
overflow-x: hidden;
font: 3vmin trebuchet ms, verdana, sans-serif;
}
header {
position: relative;
height: 100vh;
background:
url(http://imgsrc.hubblesite.org/hu/db/images/hs-2012-10-c-xlarge_web.jpg);
background-size: cover;
text-align: center;
&:before {
position: absolute;
z-index: 0;
left: calc(50% - 50vh);
width: 100vh; height: 100vh;
transform: skewX($a) scaleY(($bg-size/$covered)*cos($a));
background:
linear-gradient(90deg, transparent $p, $c $p, $c 100% - $p, transparent 100% - $p)
calc(50% - #{50vh - $bg-size/2}) 0*$covered + ($covered - $bg-size)/2,
linear-gradient(90deg, transparent $p, $c $p, $c 100% - $p, transparent 100% - $p)
calc(50% - #{50vh - $bg-size/2}) 1*$covered + ($covered - $bg-size)/2,
linear-gradient(90deg, transparent $p, $c $p, $c 100% - $p, transparent 100% - $p)
calc(50% - #{50vh - $bg-size/2}) 2*$covered + ($covered - $bg-size)/2,
linear-gradient(90deg, transparent $p, $c $p, $c 100% - $p, transparent 100% - $p)
calc(50% - #{50vh - $bg-size/2}) 3*$covered + ($covered - $bg-size)/2;
background-attachment: fixed;
background-repeat: repeat-x;
background-size: $bg-size $bg-size;
content: '';
}
}
h1 {
display: inline-block;
position: relative;
z-index: 1;
padding: 0 .5em;
color: white;
line-height: 100vh;
text-overflow: ellipsis;
white-space: nowrap;
&:before {
position: absolute;
z-index: -1;
top: calc(50% - .75em); left: 0;
width: 100%; height: 1.5em;
transform: skew($a);
opacity: .65;
background: rgb(50, 20, 280);
color: rgb(50, 20, 280);
transition: .7s $easeInOutBack;
content: '';
}
}
.title {
&--fixed {
position: fixed;
left: 0;
width: 100%;
line-height: 1.5;
&:before {
transform: none;
}
}
}
p { padding: 1em .5em; }
@media (max-width: 533px), (max-height: 533px) {
html { font-size: 16px; }
}
addEventListener('scroll', function(e) {
var header = document.querySelector('header'),
h = getComputedStyle(header).height.split('px')[0],
title = header.querySelector('h1'),
fs = getComputedStyle(title).fontSize.split('px')[0],
fix_cls = 'title--fixed';
if(window.pageYOffset > (h - 1.5*fs)/2 && !title.classList.contains(fix_cls)) {
title.classList.add(fix_cls);
}
if(window.pageYOffset < (h - 1.5*fs)/2 && title.classList.contains(fix_cls)) {
title.classList.remove(fix_cls);
}
}, false);
Also see: Tab Triggers