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. You can use the CSS from another Pen by using it's URL and the proper URL extention.
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 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.
<main id="main">
<section>
<h1 id="title">A Tribute To </h1>
<div id="img-div">
<figure>
<img id="image" src="https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fimages2.minutemediacdn.com%2Fimage%2Fupload%2Fc_fill%2Cg_auto%2Ch_1248%2Cw_2220%2Fv1555924051%2Fshape%2Fmentalfloss%2Falf-header.jpg%3Fitok%3DX5N4esgu&f=1&nofb=1" alt="A picture of ALF">
<figcaption id="img-caption">ALF</figcaption>
</figure>
</div
</section>
<section>
<article id="tribute-info">
<p>
ALF is an American television sitcom that aired on NBC from September 22, 1986, to March 24, 1990.
</p>
<p>
The title character is ALF (an acronym for "alien life form") who crash-lands in the garage of the suburban middle-class Tanner family. The series stars Max Wright as father Willie Tanner, Anne Schedeen as mother Kate Tanner and Andrea Elson and Benji Gregory as their children, Lynn and Brian Tanner. ALF was performed by puppeteer Paul Fusco, who co-created the show with Tom Patchett.
</p>
<p>
Produced by Alien Productions, ALF originally ran for four seasons and produced 99 episodes, including three one-hour episodes ("Try to Remember", "ALF's Special Christmas" and "Tonight, Tonight") that were divided into two parts for syndication, totaling 102 episodes. The series proper concluded with an unresolved cliffhanger, but the later TV movie, Project: ALF, provided a series finale for the franchise.
</p>
<p>
In August 2018, Warner Bros. Television announced development of an ALF reboot. These plans were cancelled in November 2018.
</p>
</article>
</section>
</main>
<footer>
<a id="tribute-link" href="https://www.imdb.com/title/tt0090390/" target="_blank">More information about ALF</a>
</footer>
body {
background: url("https://external-content.duckduckgo.com/iu/?u=http%3A%2F%2Ftrendintech.com%2Fwp-content%2Fuploads%2F2017%2F09%2Fgalaxy-wallpaper-11-2.jpg&f=1&nofb=1");
background-size: cover;
background-repeat:no-repeat;
}
#title {
font-size:3em;
color:whitesmoke;
letter-spacing:4px;
}
img {
width:50%;
border-radius:5%;
box-shadow: 0 30px 40px rgba(0,0,0,.2);
max-width: 100%;
display: block ;
margin:0 auto;
}
#main, footer{
font-family:"Gill Sans", san-serif;
color:black;
letter-spacing:1.5px;
font-weight:100;
display:flex;
flex-direction:column;
text-align:center;
align-items:center;
width:100vw;
padding:0 15% 0 15%;
max-width: 960px;
display:block;
}
#tribute-info{
background: linear-gradient(96.2deg, rgb(255, 230, 112, 0.4) 10.4%, rgb(255, 100, 100, 0.8) 43.8%, rgb(0, 93, 219, 0.8) 105.8%);
border-radius: 10px;
}
#img-caption {
font-weight:bold;
font-size:2em;
color:whitesmoke;
}
article {
}
a {
border:1px solid #680747;
border-radius:5px;
padding:5px 10px;
text-decoration:none;
background-color:#680747;
color:whitesmoke;
transition: box-shadow 500ms ease-in-out;
}
a:hover{
box-shadow: 0 2px #f70776;
color:yellow;
}
@media (min-width:600px){
#main #title{
font-size:2em;
letter-spacing:.9px;
}
}
Also see: Tab Triggers