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.
%section
.container.hero-container
%header
%h2 Sass mixin to create linear stepped gradients
%article
%pre
%code @include strips(<strong>color</strong>, <strong>rotation</strong>);
%p - <strong>color</strong> can be a color name, an hexadecimal, a rgb(a) color, hsl ..
%p - <strong>rotation</strong> is the rotation degree, ex : 45deg
%a{href: "https://gist.github.com/LukyVj/4dbcbc9b60b9b79703c0",class:"btn blue", target: "_blank"} Gist
%section
.container
%a.btn{:href => "#", class: "blue"}Booya
%a.btn{:href => "#", class: "red"}Booya
%a.btn{:href => "#", class: "green"}Booya
%a.btn{:href => "#", class: "purple"}Booya
.container
%a.btn{:href => "#", class: "orange"}Booya
%a.btn{:href => "#", class: "lime"}Booya
%a.btn{:href => "#", class: "white"}Booya
%a.btn{:href => "#", class: "pink"}Booya
%section
.container
%a.btn{:href => "#", class: "blue"}Booya
%a.btn{:href => "#", class: "red"}Booya
%a.btn{:href => "#", class: "green"}Booya
%a.btn{:href => "#", class: "purple"}Booya
.container
%a.btn{:href => "#", class: "orange"}Booya
%a.btn{:href => "#", class: "lime"}Booya
%a.btn{:href => "#", class: "white"}Booya
%a.btn{:href => "#", class: "pink"}Booya
%section
.container
%header.center
%h2 Fancier?
////////////// GLOSSY
%section
.container
%pre
%code .glossy
.container
%a.btn{:href => "#", class: "blue glossy"}Booya
%a.btn{:href => "#", class: "red glossy"}Booya
%a.btn{:href => "#", class: "green glossy"}Booya
%a.btn{:href => "#", class: "purple glossy"}Booya
.container
%a.btn{:href => "#", class: "orange glossy"}Booya
%a.btn{:href => "#", class: "lime glossy"}Booya
%a.btn{:href => "#", class: "white glossy"}Booya
%a.btn{:href => "#", class: "pink glossy"}Booya
%section
.container
%pre
%code .glossy
.container
%a.btn{:href => "#", class: "blue glossy"}Booya
%a.btn{:href => "#", class: "red glossy"}Booya
%a.btn{:href => "#", class: "green glossy"}Booya
%a.btn{:href => "#", class: "purple glossy"}Booya
.container
%a.btn{:href => "#", class: "orange glossy"}Booya
%a.btn{:href => "#", class: "lime glossy"}Booya
%a.btn{:href => "#", class: "white glossy"}Booya
%a.btn{:href => "#", class: "pink glossy"}Booya
////////////// NOISY
%section
.container
%pre
%code .noisy
.container
%a.btn{:href => "#", class: "blue noisy"}Booya
%a.btn{:href => "#", class: "red noisy"}Booya
%a.btn{:href => "#", class: "green noisy"}Booya
%a.btn{:href => "#", class: "purple noisy"}Booya
.container
%a.btn{:href => "#", class: "orange noisy"}Booya
%a.btn{:href => "#", class: "lime noisy"}Booya
%a.btn{:href => "#", class: "white noisy"}Booya
%a.btn{:href => "#", class: "pink noisy"}Booya
%section
.container
%pre
%code .noisy
.container
%a.btn{:href => "#", class: "blue noisy"}Booya
%a.btn{:href => "#", class: "red noisy"}Booya
%a.btn{:href => "#", class: "green noisy"}Booya
%a.btn{:href => "#", class: "purple noisy"}Booya
.container
%a.btn{:href => "#", class: "orange noisy"}Booya
%a.btn{:href => "#", class: "lime noisy"}Booya
%a.btn{:href => "#", class: "white noisy"}Booya
%a.btn{:href => "#", class: "pink noisy"}Booya
////////////// BenDay
%section
.container
%pre
%code .benday
.container
%a.btn{:href => "#", class: "blue benday"}Booya
%a.btn{:href => "#", class: "red benday"}Booya
%a.btn{:href => "#", class: "green benday"}Booya
%a.btn{:href => "#", class: "purple benday"}Booya
.container
%a.btn{:href => "#", class: "orange benday"}Booya
%a.btn{:href => "#", class: "lime benday"}Booya
%a.btn{:href => "#", class: "white benday"}Booya
%a.btn{:href => "#", class: "pink benday"}Booya
%section
.container
%pre
%code .benday
.container
%a.btn{:href => "#", class: "blue benday"}Booya
%a.btn{:href => "#", class: "red benday"}Booya
%a.btn{:href => "#", class: "green benday"}Booya
%a.btn{:href => "#", class: "purple benday"}Booya
.container
%a.btn{:href => "#", class: "orange benday"}Booya
%a.btn{:href => "#", class: "lime benday"}Booya
%a.btn{:href => "#", class: "white benday"}Booya
%a.btn{:href => "#", class: "pink benday"}Booya
%footer
%p Brought to you by <a href="https://twitter.com/LukyVj">@LukyVj</a>, inspired by <a href="https://dribbble.com/shots/2565545-Sign-up" target="_blank">This Dribbble shot</a>
$primary-color: #56C3FF;
$btn-width: 180px;
$colors: (
(blue, #56C3FF, 85deg),
(red, #CE383C, 75deg),
(green, #98BB3A, 65deg),
(purple, #B093C4, 55deg),
(orange, #EB922A, 45deg),
(lime, #A9D063, 35deg),
(white, #eeeeee, 25deg),
(pink, #E84A87, 15deg)
);
// Background mixin
@mixin strips($color, $angle){
$color: saturate(lighten($color, 2%), 10%);
background: $color
linear-gradient($angle, $color 0%, $color 10%,
mix(black, $color, 5%) 10%, mix(black, $color, 5%) 20%,
mix(black, $color, 12%) 19%, mix(black, $color, 10%) 21%, // Thin line between gradient
mix(black, $color, 10%) 20%,mix(black, $color, 10%) 30%,
mix(black, $color, 17%) 29%, mix(black, $color, 15%) 31%, // Thin line between gradient
mix(black, $color, 15%) 30%,mix(black, $color, 15%) 40%,
mix(black, $color, 22%) 39%, mix(black, $color, 20%) 41%, // Thin line between gradient
mix(black, $color, 20%) 40%,mix(black, $color, 20%) 50%,
mix(black, $color, 27%) 49%, mix(black, $color, 25%) 51%, // Thin line between gradient
mix(black, $color, 25%) 50%,mix(black, $color, 25%) 60%,
mix(black, $color, 32%) 59%, mix(black, $color, 30%) 61%, // Thin line between gradient
mix(black, $color, 30%) 60%,mix(black, $color, 30%) 70%,
mix(black, $color, 37%) 69%, mix(black, $color, 35%) 71%, // Thin line between gradient
mix(black, $color, 35%) 70%,mix(black, $color, 35%) 80%,
mix(black, $color, 42%) 79%, mix(black, $color, 40%) 81%, // Thin line between gradient
mix(black, $color, 40%) 80%,mix(black, $color, 40%) 90%,
mix(black, $color, 47%) 89%, mix(black, $color, 45%) 91%, // Thin line between gradient
mix(black, $color, 45%) 90%,mix(black, $color, 45%) 100%);
&.glossy {
position: relative;
overflow: hidden;
&:after {
content: '';
display: block;
width: 80%;
height: 35%;
background: linear-gradient(to bottom , rgba(white, 0.6), rgba(black, 1));
box-shadow: inset 0 5px 6px rgba(white, 0.6);
border-radius: 100%;
mix-blend-mode: screen;
position: absolute;
top: -4px;
left: 0;
right: 0;
margin: auto;
}
&:before {
content: '';
display: block;
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
box-shadow: inset 0 -6px 30px rgba(black, 0.4);
}
}
&.noisy {
position: relative;
overflow: hidden;
&:before,
&:after{
content: '';
display: block;
width: 100%;
height: 100%;
background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAMAAAAp4XiDAAAAUVBMVEWFhYWDg4N3d3dtbW17e3t1dXWBgYGHh4d5eXlzc3OLi4ubm5uVlZWPj4+NjY19fX2JiYl/f39ra2uRkZGZmZlpaWmXl5dvb29xcXGTk5NnZ2c8TV1mAAAAG3RSTlNAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEAvEOwtAAAFVklEQVR4XpWWB67c2BUFb3g557T/hRo9/WUMZHlgr4Bg8Z4qQgQJlHI4A8SzFVrapvmTF9O7dmYRFZ60YiBhJRCgh1FYhiLAmdvX0CzTOpNE77ME0Zty/nWWzchDtiqrmQDeuv3powQ5ta2eN0FY0InkqDD73lT9c9lEzwUNqgFHs9VQce3TVClFCQrSTfOiYkVJQBmpbq2L6iZavPnAPcoU0dSw0SUTqz/GtrGuXfbyyBniKykOWQWGqwwMA7QiYAxi+IlPdqo+hYHnUt5ZPfnsHJyNiDtnpJyayNBkF6cWoYGAMY92U2hXHF/C1M8uP/ZtYdiuj26UdAdQQSXQErwSOMzt/XWRWAz5GuSBIkwG1H3FabJ2OsUOUhGC6tK4EMtJO0ttC6IBD3kM0ve0tJwMdSfjZo+EEISaeTr9P3wYrGjXqyC1krcKdh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q+f8XN+A5eeUKHWvJWJ2sgJ1Sop+wwhqFVijqWaJhwtD8MNlSBeWNNWTa5Z5kPZw5+LbVT99wqTdx29lMUH4OIG/D86ruKEauBjvH5xy6um/Sfj7ei6UUVk4AIl3MyD4MSSTOFgSwsH/QJWaQ5as7ZcmgBZkzjjU1UrQ74ci1gWBCSGHtuV1H2mhS nO3Wp/3fEV5a+4wz//6qy8JxjZsmxxy5+4w9CDNJY09T072iKG0EnOS0arEYgXqYnXcYHwjTtUNAcMelOd4xpkoqiTYICWFq0JSiPfPDQdnt+4/wuqcXY47QILbgAAAABJRU5ErkJggg==');
mix-blend-mode: screen;
position: absolute;
top: 0;
left: 0;
right: 0;
margin: auto;
background-size: 30%;
background-position: center center;
}
&:before {
content: '';
display: block;
width: 100%;
height: 100%;
position: absolute;
background-size: 80%;
left: 0;
top: 0;
z-index: 0;
mix-blend-mode: color-burn;
background-position: center bottom;
}
}
&.benday {
position: relative;
overflow: hidden;
&:before,
&:after{
content: '';
display: block;
width: 100%;
height: 100%;
background: linear-gradient(to bottom, rgba(#fff, 0.0001) 10%, rgba(#fff, 0.1)),
repeating-radial-gradient(center center, rgba(255,255,255,0.1), rgba(255,255,255,0.1) 1px, transparent 2px, transparent 100%);
mix-blend-mode: lighten;
position: absolute;
top: 0;
left: 0;
right: 0;
margin: auto;
background-size: cover,
4px 4px;
background-position: center center;
}
&:before {
content: '';
display: block;
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
z-index: 0;
mix-blend-mode: lighten;
}
}
}
// Personal reset and settings
// Not important
:root{
font-size: 16px;
}
*{
box-sizing: border-box;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscaled;
}
html, body {
width: 100%;
height: 100%;
float: left;
padding: 0;
margin: 0;
}
body {
background: #ECEBF2;
font-family: "Raleway", Helvetica new, helvetica, sans-serif;
}
// Helper
.center {
text-align: center;
line-height: 4;
text-transform: uppercase;
letter-spacing: 6px;
font-size: 1.5em;
}
// Sections styles
section {
width: 100vw;
min-height: 400px;
height: 50vh;
position: relative;
background: #dedede;
float: left;
&:nth-child(1) {
background-blend-mode: darken;
}
&:nth-child(odd) {
color: mix(#2A2734, #fff, 85%);
}
&:nth-child(even) {
background: mix(#2A2734, #fff, 85%);
color: #dedede;
}
.container {
max-width: calc((#{$btn-width} * 4) + 64px);
height: auto;
position: relative;
top: 15vh;
left: 0;
right: 0;
bottom: 0;
margin: auto;
&.hero-container{
@media (max-width: 780px) {
padding: 16px;
}
h2 {
border-bottom: 3px solid;
display: inline-block;
padding-bottom: 0.35em;
margin-bottom: 0.5em;
}
.btn {
@include strips(#86C5DB, 60deg);
border-radius: 6px;
padding: 8px 16px;
margin: 0;
line-height: 20px;
height: auto;
font-size: 16px;
position: relative;
float: right;
}
}
}
}
// The button starts here
.btn {
display: block;
padding: 0 1.5em;
height: 80px;
max-width: 180px;
text-align: center;
max-height: 80px;
line-height: 80px;
border-radius: 100px;
color: #fff;
font-size: 1.5em;
text-decoration: none;
text-align: center;
display: block;
float: left;
margin: 8px;
text-transform: uppercase;
font-weight: 600;
letter-spacing: 4px;
will-change: box-shadow;
transition: box-shadow 0.4s ease;
// The background starts here
// By looking the code below, you can
// see how simple it is, also using a
// mix() Sass function is better
// to create colors gradient, it's more
// precise and accurate than a darken()/lighten()
// function.
// see : https://codepen.io/KatieK2/pen/tejhz/
@each $c , $v, $d in $colors {
&.#{$c} {
@include strips($v, $d);
border-bottom: 1px solid rgba($v, 0.2);
box-shadow: 0 1px 1px rgba($v, 0.4);
&:hover {
box-shadow: 0 4px 10px rgba($v, 0.6);
section:nth-child(even) &{
box-shadow: 0 4px 15px rgba($v, 0.25), 0 4px 10px rgba(#000, 0.35);
}
}
}
}
// All about centering
section & {
&:nth-child(5) {
clear: left;
}
}
}
footer {
height: auto;
position: relative;
background: #dedede;
float: left;
min-height: 10vh;
width: 100%;
text-align: center;
font-weight: 400;
line-height: 10vh;
color: #4A4752;
a {
color: #4A4752;
text-decoration: none;
border-bottom: 1px solid #4A4752;
}
}
// Inspired by this Dribbble shot from Alexandre Naud <@alexnnd>
// https://dribbble.com/shots/2565545-Sign-up
Also see: Tab Triggers