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 class="scrollHalf">
<div class="scrollHalf__grupo" data-scroll>
<div class="scrollHalf__grupo__imagen">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/106155/OrionTree_Fairbairn_1071.jpg" />
</div>
<div class="scrollHalf__grupo__contenido">
<h1>Titulo 1</h1>
Betelgeuse
Map of the constellation Orion
Red circle.svg
Betelgeuse (circled) in the constellation Orion
Observation data
Epoch J2000.0 Equinox J2000.0
Constellation Orion
Pronunciation /ˈbiːtəldʒuːz, ˈbɛtəl-, -dʒuːs/[1][2]
Right ascension 05h 55m 10.30536s[3]
Declination +07° 24′ 25.4304″[3]
Characteristics
Evolutionary stage Red supergiant
Spectral type M1–M2 Ia–ab[4]
Apparent magnitude (V) 0.50[5] (0.0 - 1.3[6])
Apparent magnitude (J) −3.00[7]
Apparent magnitude (K) −4.05[7]
U−B color index +2.06[5]
B−V color index +1.85[5]
Variable type SRc[6]
Astrometry
Radial velocity (Rv) +21.91[8] km/s
Proper motion (μ) RA: 26.42 ± 0.25[9] mas/yr
Dec.: 9.60 ± 0.12[9] mas/yr
Parallax (π) 4.51 ± 0.80[9] mas
Distance 222+48
−34[9] pc
Absolute magnitude (MV) −5.85[10]
Details
Mass 11.6+5.0
−3.9[11] M☉
Radius 887 ± 203[12], 955±217[11] R☉
Luminosity 90000 – 150000[13] L☉
Surface gravity (log g) −0.5[14] cgs
Temperature 3590[11] K
Metallicity [Fe/H] +0.05[15] dex
Rotational velocity (v sin i) 5[16] km/s
Age 8.0 – 8.5[12] Myr
Other designations
Betelgeuse, α Ori, 58 Ori, HR 2061, BD+7°1055, HD 39801, FK5 224, HIP 27989, SAO 113271, GC 7451, CCDM J05552+0724AP, AAVSO 0549+07
Database references
SIMBAD data
Coordinates: Sky map 05h 55m 10.3053s, +07° 24′ 25.426″
</div>
</div>
<div class="scrollHalf__grupo kk" data-scroll>
<div class="scrollHalf__grupo__imagen">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/106155/1920px-Betelgeuse_captured_by_ALMA.jpg" />
<!--
De ALMA, CC BY 4.0, https://commons.wikimedia.org/w/index.php?curid=60432670
-->
</div>
<div class="scrollHalf__grupo__contenido">
<h1>Titulo 2</h1>
This orange blob shows the nearby star Betelgeuse, as seen by the Atacama Large Millimeter/submillimeter Array (ALMA). This is the first time that ALMA has ever observed the surface of a star and this first attempt has resulted in the highest-resolution image of Betelgeuse available.
Betelgeuse, also designated Alpha Orionis (α Orionis, abbreviated Alpha Ori, α Ori), is on average the ninth-brightest star in the night sky and second-brightest in the constellation of Orion. It is distinctly reddish, and is a semiregular variable star whose apparent magnitude varies between 0.0 and 1.3, the widest range of any first-magnitude star. Betelgeuse is one of three stars that make up the Winter Triangle asterism, and it marks the center of the Winter Hexagon. It would be the brightest star in the night sky if the human eye could view all wavelengths of radiation. fghfghfh fg hgfd
</div>
</div>
<div class="scrollHalf__grupo" data-scroll>
<div class="scrollHalf__grupo__imagen">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/106155/potw1726b.jpg" />
</div>
<div class="scrollHalf__grupo__contenido">
<h1>Titulo 3</h1>
Classified as a red supergiant of spectral type M1-2, the star is one of the largest stars visible to the naked eye. If Betelgeuse were at the center of the Solar System, its surface would extend past the asteroid belt, completely engulfing the orbits of Mercury, Venus, Earth, Mars, and possibly Jupiter. However, there are several other red supergiants in the Milky Way that could be larger, such as Mu Cephei, VV Cephei A, and VY Canis Majoris. Calculations of its mass range from slightly under ten to a little over twenty times that of the Sun. It is calculated to be 640 light-years away, yielding an absolute magnitude of about −6. Less than 10 million years old, Betelgeuse has evolved rapidly because of its high mass. Having been ejected from its birthplace in the Orion OB1 Association—which includes the stars in Orion's Belt—this runaway star has been observed moving through the interstellar medium at a speed of 30 km/s, creating a bow shock over four light-years wide. Currently in a late stage of stellar evolution, the supergiant is expected to explode as a supernova within the next million years.
In 1920, Betelgeuse became the first extrasolar star to have the angular size of its photosphere measured. Subsequent studies have reported an angular diameter (apparent size) ranging from 0.042 to 0.056 arcseconds, with the differences ascribed to the non-sphericity, limb darkening, pulsations, and varying appearance at different wavelengths. It is also surrounded by a complex, asymmetric envelope roughly 250 times the size of the star, caused by mass loss from the star itself. The angular diameter of Betelgeuse is only exceeded by R Doradus (and the Sun).
</div>
</div>
</div>
* { box-sizing: border-box;}
body { font-size: 30px; padding: 0; margin: 0;}
.scrollHalf { position: relative}
/*.scrollHalf__grupo { opacity: calc(1/(1+(var(--visible-y)*var(--visible-y)*var(--visible-y)*var(--visible-y)))); transition: all 200ms ease-in-out;}*/
.scrollHalf__grupo { transition: all 200ms ease-in-out; }
.scrollHalf__grupo__imagen { overflow: hidden; }
.scrollHalf__grupo__contenido { padding: 3rem; }
.scrollHalf__grupo[data-scroll="out"] { opacity: 0;}
.scrollHalf__grupo[data-scroll="in"] { opacity: calc(var(--visible-y)*1.9); }
@media screen and (min-width:900px) {
.scrollHalf__grupo { min-height: 100vh;}
.scrollHalf__grupo__imagen { position: fixed; top: 0; left: 0; width: 50vw;}
.scrollHalf__grupo__imagen img { min-height: 100vh; min-width: 50vw; }
.scrollHalf__grupo__contenido { margin: 0 3vw 0 52vw;}
}
$(document).ready(function($) {
console.clear();
ScrollOut({
cssProps: {
visibleY: true,
viewportY: true,
scrollPercentY: true
},
threshold:0.2
});
});
Also see: Tab Triggers