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 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.
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.
If the stylesheet 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 CSS 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.
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 Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
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="top"><br></div>
<div class="container">
<div class="jumbotron">
<div class="row">
<div id="space">
<div class="space_field_wrapper">
<div class="space_field mother">
<img src="http://www.thevintagenews.com/wp-content/uploads/2015/06/Stephen-Hawking-Date-17-05-1963.jpg" alt="Photo of a young Stephen Hawking" class="portrait rounded-circle">
</div>
</div>
<div class="space_field_wrapper">
<div class="space_field satellite">
<div class="planet"></div>
</div>
</div>
<div class="space_field_wrapper">
<div class="space_field satellite">
<div class="planet"></div>
</div>
</div>
<div class="space_field_wrapper">
<div class="space_field satellite">
<div class="planet"></div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-10">
<h1 class="display-3">Stephen Hawking</h1>
<p class="lead">was a British theoretical physicist, cosmologist, author and Director of Research at the Centre for Theoretical Cosmology within the University of Cambridge. His scientific works include a collaboration with Roger Penrose on gravitational singularity theorems in the framework of general relativity and the theoretical prediction that black holes emit radiation, often called Hawking radiation. Hawking was the first to set out a theory of cosmology explained by a union of the general theory of relativity and quantum mechanics. He was a vigorous supporter of the many-worlds interpretation of quantum mechanics.</p>
</div>
<div class="col-2">
</div>
</div>
</div>
<div class="jumbotron">
<div class="row">
<div class="col">
<h1 class="display-3 title">Books</h1>
</div>
</div>
<div class="row">
<div class="col-4"><h2 class="text-right">A Brief History of Time</h2></div>
<div class="col-8">In 1988 Hawking catapulted to international prominence with the publication of A Brief History of Time. The short, informative book became an account of cosmology for the masses and offered an overview of space and time, the existence of God and the future. The work was an instant success, spending more than four years atop the London Sunday Times' best-seller list. Since its publication, it has sold millions of copies worldwide and been translated into more than 40 languages.</div>
</div>
<div class="row mt-3">
<div class="col-4"><h2 class="text-right">The Universe in a Nutshell</h2></div>
<div class="col-8">A Brief History of Time also wasn't as easy to understand as some had hoped. So in 2001, Hawking followed up his book with The Universe in a Nutshell, which offered a more illustrated guide to cosmology's big theories.</div>
</div>
<div class="row mt-3">
<div class="col-4"><h2 class="text-right">A Briefer History of Time</h2></div>
<div class="col-8">In 2005, Hawking authored the even more accessible A Briefer History of Time, which further simplified the original work's core concepts and touched upon the newest developments in the field like string theory.
</div>
</div>
<blockquote class="blockquote text-center mt-3 font-italic">Together these three books, along with Hawking's own research and papers, articulated the physicist's personal search for science's Holy Grail: a single unifying theory that can combine cosmology (the study of the big) with quantum mechanics (the study of the small) to explain how the universe began. This kind of ambitious thinking allowed Hawking, who claimed he could think in 11 dimensions, to lay out some big possibilities for humankind. He was convinced that time travel is possible, and that humans may indeed colonize other planets in the future.</blockquote>
<div class="row mt-4">
<div class="col-4"><h2 class="text-right">The Grand Design</h2></div>
<div class="col-8">In September 2010, Hawking spoke against the idea that God could have created the universe in his book The Grand Design. Hawking previously argued that belief in a creator could be compatible with modern scientific theories. In this work, however, he concluded that the Big Bang was the inevitable consequence of the laws of physics and nothing more. "Because there is a law such as gravity, the universe can and will create itself from nothing," Hawking said. "Spontaneous creation is the reason there is something rather than nothing, why the universe exists, why we exist."</div>
</div>
<blockquote class="blockquote text-center mt-3 font-italic">The Grand Design was Hawking's first major publication in almost a decade. Within his new work, Hawking set out to challenge Sir Isaac Newton's belief that the universe had to have been designed by God, simply because it could not have been born from chaos. "It is not necessary to invoke God to light the blue touch paper and set the universe going," Hawking said.</blockquote>
</div>
<div class="jumbotron">
<div class="row">
<div class="col">
<h1 class="display-3 title">Links</h1>
</div>
</div>
<div class="row">
<div class="col-4">
<div class="card">
<div class="card-body">
<h5 class="card-title">Wikipedia</h5>
<h6 class="card-subtitle mb-2 text-muted">Stephen Hawking</h6>
<p class="card-text">Stephen William Hawking CH CBE FRS FRSA (/ˈstiːvən ˈhɔːkɪŋ/ (About this sound listen); 8 January 1942 – 14 March 2018) was a British...</p>
<a href="https://en.wikipedia.org/wiki/Stephen_Hawking" target="_blank" class="card-link">Go to</a>
</div>
</div>
</div>
<div class="col-4">
<div class="card">
<div class="card-body">
<h5 class="card-title">Hawking.org.uk</h5>
<h6 class="card-subtitle mb-2 text-muted">Official Website</h6>
<p class="card-text">Stephen Hawking is the former Lucasian Professor of Mathematics at the University of Cambridge and author of A Brief History of Time...</p>
<a href="http://www.hawking.org.uk" class="card-link" target="_blank">Go to</a>
</div>
</div>
</div>
<div class="col-4">
<div class="card">
<div class="card-body">
<h5 class="card-title">Obituary</h5>
<h6 class="card-subtitle mb-2 text-muted">by Roger Penrose</h6>
<p class="card-text">The image of Stephen Hawking – who has died aged 76 – in his motorised wheelchair, with head contorted slightly to one side and hands...</p>
<a href="https://www.theguardian.com/science/2018/mar/14/stephen-hawking-obituary" class="card-link" target="_blank">Card link</a>
</div>
</div>
</div>
</div>
</div>
<div class="float-right totop">
<a href="#top">
<i class="fas fa-arrow-up"></i>
</a>
</div>
<br><br><br>
</div>
body {
height: 100%;
background-image: url("https://cdn-images-1.medium.com/max/2000/1*LHDCHRrcUtz0hlHb7zn6PQ.jpeg");
background-position: center;
background-repeat: no-repeat;
background-size: cover;
background-attachment: fixed;
overflow-x: hidden;
}
.card {
border-radius: 10px;
}
.totop a {
display: inline;
color: #CCCCCC;
border: 15px solid #FFFFFF;
border-radius: 10%;
width: 3px;
height: 3px;
overflow: hidden;
background-color: #FFFFFF;
}
.jumbotron {
border: 10px solid #FFF;
border-radius: 10px;
}
.jumbotron:first-child{
margin-top: 18px;
}
.portrait {
width: 200px;
height: 200px;
border: 10px solid white;
transform: translate(35%, 35%);
}
.title {
margin-bottom: 18px;
}
/*Orbit Magic Starts Here*/
#space {
position: relative;
top: 120px;
right:-525px;
width: 100%;
height: 100%;
-webkit-transform-style: preserve-3d;
transform-style: preserve-3d;
}
#space .space_field {
position: absolute;
top: 50%;
left: 50%;
width: 300px;
height: 300px;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
-webkit-transform-style: preserve-3d;
transform-style: preserve-3d;
}
#space .space_field .planet {
position: absolute;
top: 50%;
left: 50%;
overflow: hidden;
border-radius: 100%;
-webkit-box-sizing: border-box;
box-sizing: border-box;
border: 10px solid #FFF;
}
#space .space_field.mother .planet {
width: 200px;
height: 200px;
background: #ff5032;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
#space .space_field.mother .planet::before {
content: '';
position: absolute;
top: 0%;
left: 0%;
width: 100%;
height: 100%;
background: #642800;
border-radius: 100%;
mix-blend-mode: screen;
}
#space .space_field.satellite .planet {
left: 100%;
width: 50px;
height: 50px;
background: #3250ff;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
#space .space_field.satellite .planet::before {
content: '';
position: absolute;
top: -15%;
left: -15%;
width: 100%;
height: 100%;
background: rgba(255, 255, 255, 0.4);
border-radius: 100%;
}
#space .space_field_wrapper {
position: absolute;
width: 100%;
height: 100%;
-webkit-transform-style: preserve-3d;
transform-style: preserve-3d;
}
#space .space_field_wrapper:nth-child(1) {
-webkit-transform: rotateZ(0deg);
transform: rotateZ(0deg);
}
#space .space_field_wrapper:nth-child(1) .space_field.satellite {
-webkit-animation: orbit 2400ms linear infinite;
animation: orbit 2400ms linear infinite;
}
#space .space_field_wrapper:nth-child(1) .space_field.satellite .planet {
-webkit-animation: planet 2400ms linear infinite;
animation: planet 2400ms linear infinite;
background: #37ffae;
}
#space .space_field_wrapper:nth-child(2) {
-webkit-transform: rotateZ(-20deg);
transform: rotateZ(-20deg);
}
#space .space_field_wrapper:nth-child(2) .space_field.satellite {
-webkit-animation: orbit 2800ms linear infinite;
animation: orbit 2800ms linear infinite;
}
#space .space_field_wrapper:nth-child(2) .space_field.satellite .planet {
-webkit-animation: planet 2800ms linear infinite;
animation: planet 2800ms linear infinite;
background: #e4366a;
}
#space .space_field_wrapper:nth-child(3) {
-webkit-transform: rotateZ(-40deg);
transform: rotateZ(-40deg);
}
#space .space_field_wrapper:nth-child(3) .space_field.satellite {
-webkit-animation: orbit 3200ms linear infinite;
animation: orbit 3200ms linear infinite;
}
#space .space_field_wrapper:nth-child(3) .space_field.satellite .planet {
-webkit-animation: planet 3200ms linear infinite;
animation: planet 3200ms linear infinite;
background: #491b88;
}
#space .space_field_wrapper:nth-child(4) {
-webkit-transform: rotateZ(-60deg);
transform: rotateZ(-60deg);
}
#space .space_field_wrapper:nth-child(4) .space_field.satellite {
-webkit-animation: orbit 3600ms linear infinite;
animation: orbit 3600ms linear infinite;
}
#space .space_field_wrapper:nth-child(4) .space_field.satellite .planet {
-webkit-animation: planet 3600ms linear infinite;
animation: planet 3600ms linear infinite;
background: #7d2e68;
}
@-webkit-keyframes orbit {
0% {
-webkit-transform: translate(-50%, -50%) rotateY(0deg);
transform: translate(-50%, -50%) rotateY(0deg);
}
100% {
-webkit-transform: translate(-50%, -50%) rotateY(360deg);
transform: translate(-50%, -50%) rotateY(360deg);
}
}
@keyframes orbit {
0% {
-webkit-transform: translate(-50%, -50%) rotateY(0deg);
transform: translate(-50%, -50%) rotateY(0deg);
}
100% {
-webkit-transform: translate(-50%, -50%) rotateY(360deg);
transform: translate(-50%, -50%) rotateY(360deg);
}
}
@-webkit-keyframes planet {
0% {
-webkit-transform: translate(-50%, -50%) rotateY(0deg);
transform: translate(-50%, -50%) rotateY(0deg);
}
100% {
-webkit-transform: translate(-50%, -50%) rotateY(-360deg);
transform: translate(-50%, -50%) rotateY(-360deg);
}
}
@keyframes planet {
0% {
-webkit-transform: translate(-50%, -50%) rotateY(0deg);
transform: translate(-50%, -50%) rotateY(0deg);
}
100% {
-webkit-transform: translate(-50%, -50%) rotateY(-360deg);
transform: translate(-50%, -50%) rotateY(-360deg);
}
}
// Only works correctly on bigger screens.
// Borrowed and slightly edited orbit animation from another pen:
// https://codepen.io/YusukeNakaya/pen/gxymVv
$('a[href*="#"]')
// Remove links that don't actually link to anything
.not('[href="#"]')
.not('[href="#0"]')
.click(function(event) {
// On-page links
if (
location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '')
&&
location.hostname == this.hostname
) {
// Figure out element to scroll to
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
// Does a scroll target exist?
if (target.length) {
// Only prevent default if animation is actually gonna happen
event.preventDefault();
$('html, body').animate({
scrollTop: target.offset().top
}, 1000, function() {
// Callback after animation
// Must change focus!
var $target = $(target);
$target.focus();
if ($target.is(":focus")) { // Checking if the target was focused
return false;
} else {
$target.attr('tabindex','-1'); // Adding tabindex for elements not focusable
$target.focus(); // Set focus again
};
});
}
}
});
Also see: Tab Triggers