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>
<svg width="120" height="27" viewBox="0 0 120 27" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M0 14.1492C0 6.84432 5.63704 1.30127 13.1125 1.30127C19.6147 1.30127 24.711 5.51616 25.9006 11.4116H21.1558C19.9392 8.71459 16.8841 6.84432 13.1125 6.84432C8.25954 6.84432 4.56911 9.97499 4.56911 14.1492C4.56911 18.3234 8.27306 21.4541 13.1125 21.4541C16.8841 21.4541 19.9392 19.5838 21.1558 16.8869H25.9006C24.711 22.7958 19.6147 26.9972 13.1125 26.9972C5.63704 26.9972 0 21.4541 0 14.1492Z" fill="white"/>
<path d="M46.0424 14.7587V26.5631H41.9464V16.5206C41.9464 14.3928 40.1215 13.024 37.2827 13.024C34.3358 13.024 32.3216 14.4335 32.3216 16.5884V26.5631H28.2256V0.650391H32.3216V12.1973C33.7274 9.28345 36.0525 7.76555 39.04 7.76555C43.2442 7.77911 46.0424 10.5439 46.0424 14.7587Z" fill="white"/>
<path d="M63.6703 17.3882C63.6703 14.908 61.2641 13.0377 58.0332 13.0377C54.8024 13.0377 52.4368 14.908 52.4368 17.3882C52.4368 19.8683 54.8024 21.7386 58.0332 21.7386C61.2641 21.7386 63.6703 19.8683 63.6703 17.3882ZM67.7663 8.21298V26.5633H63.6703V22.8905C62.3049 25.4113 59.9663 26.997 56.9923 26.997C51.9636 26.997 48.165 22.8499 48.165 17.3882C48.165 11.9129 51.9771 7.7793 56.9923 7.7793C59.9798 7.7793 62.3049 9.36496 63.6703 11.8858V8.21298H67.7663Z" fill="white"/>
<path d="M81.9873 7.91455V14.3927C77.648 14.3927 75.3094 15.9784 75.3094 18.8516V26.5631H71.2134V8.21271H75.3094V12.78C76.7423 9.75772 79.0809 7.91455 81.9873 7.91455Z" fill="white"/>
<path d="M88.8138 0.650391H84.7178V26.5767H88.8138V0.650391Z" fill="white"/>
<path d="M93.0179 8.21293H97.1139V26.5633H93.0179V8.21293ZM91.7607 2.87317C91.7607 1.24685 93.1937 0 95.0592 0C96.9652 0 98.3981 1.2604 98.3981 2.87317C98.3981 4.5266 96.9652 5.787 95.0592 5.787C93.1937 5.80055 91.7607 4.54015 91.7607 2.87317Z" fill="white"/>
<path d="M104.508 15.8025H115.782C115.066 13.8238 112.835 12.6041 110.105 12.6041C107.414 12.6041 105.265 13.8645 104.508 15.8025ZM119.878 18.9332H104.467C105.225 20.9119 107.347 22.1723 110.253 22.1723C112.403 22.1723 114.309 21.5624 115.133 20.7628H119.662C118.297 24.4762 114.633 26.997 110.145 26.997C104.467 26.997 100.236 22.8499 100.236 17.3882C100.236 11.9129 104.467 7.7793 110.118 7.7793C115.755 7.7793 120 11.8858 120 17.4966C119.986 17.9709 119.946 18.4995 119.878 18.9332Z" fill="white"/>
</svg>
<nav>
<ul>
<li>About</li>
<li>Services</li>
<li>Work</li>
<li class="cta">Get In Touch</li>
</ul>
</nav>
</header>
<div class="wrapper">
<h1>We create thoughtful digital experiences for modern <u>brands.</u></h1>
</div>
<div class="social">
<a href="https://twitter.com/StefCharle" target="_blank">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/149103/twitter.svg" alt="">
</a>
</div>
*{
box-sizing: border-box;
margin: 0;
padding: 0;
}
html, body{
position: relative;
width: 100%;
height: 100%;
}
canvas{
position: absolute;
top: 0;
left: 0;
}
.wrapper{
z-index: 1;
display: flex;
align-items: center;
position: relative;
padding: 0 5vw;
width: 100%;
height: 100%;
}
h1,h2,h3,h4,h5,h6,u{
&::selection {
background: #FFE300;
color: #000;
}
}
h1{
color: #FFF;
font-family: "Gopher", sans-serif;
font-size: 8vw;
mix-blend-mode: difference;
}
header{
z-index: 1;
position: fixed;
top: 0;
left: 0;
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
padding: 2rem 5vw;
background-color: transparent;
}
nav{
ul{
display: flex;
align-items: center;
font-family: 'Helvetica', sans-serif;
font-size: 1.125rem;
color: #FFF;
li{
margin: 0 3rem;
list-style-type: none;
&:first-child{ margin-left: 0; }
&:last-child{ margin-right: 0; }
&.cta{
display: inline-block;
padding: 1.5rem 3rem;
color: #000;
border-radius: 5rem;
background-color: #FFE300;
}
}
}
}
.social{
z-index: 1;
position: absolute;
right: 35px;
bottom: 35px;
img{
display: block;
width: 32px;
}
}
let points = [];
let position = {x: 0, y: 0};
let prevPosition = {x: 0, y: 0};
function setup(){
createCanvas(windowWidth, windowHeight)
}
function draw(){
background(0,104,71);
noStroke();
fill(237,188,215);
let dx = mouseX - pmouseX;
let dy = mouseY - pmouseY;
if(dx || dy){
position = {x: mouseX, y: mouseY};
if(points.length >= 50){
points.splice(0, 1);
}
points.push(position);
}
points.forEach(point => {
ellipse(point.x, point.y, 250,250)
});
}
Also see: Tab Triggers