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 data-headroom class="header fixed-top">
<nav class="navbar navbar-expand-lg text-uppercase py-0">
<a class="navbar-brand d-lg-none py-0 ms-4 me-0" href="https://www.badiali.es">
Luis <span class="fw-bold">Badiali</span>
</a>
<div class="offcanvas offcanvas-end vh-100" tabindex="-1" id="navbarOffcanvasLg" aria-labelledby="navbarOffcanvasLgLabel">
<div class="container-lg">
<div class="row flex-grow-1 p-4 p-lg-0">
<div class="d-flex d-lg-block col-lg-4 order-1 order-lg-2 text-lg-center">
<button type="button" class="d-lg-none border-0 bg-transparent p-0 ms-auto" data-bs-dismiss="offcanvas" aria-label="Cerrar">
<i class="fa-solid fa-close"></i>
</button>
<a class="navbar-brand d-none d-lg-block py-0 me-0" href="https://www.badiali.es">
Luis <span class="fw-bold">Badiali</span>
</a>
</div>
<div class="col-lg-4 order-2 order-lg-1 ms-auto ms-lg-0">
<ul class="navbar-nav d-flex flex-column flex-lg-row">
<li class="nav-item me-4 me-xxl-5">
<a class="nav-link" href="https://www.linkedin.com/in/badiali/">Sobre mi</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://codepen.io/badiali">Portfolio</a>
</li>
</ul>
</div>
<div class="col-lg-4 order-3">
<ul class="navbar-nav d-flex flex-column flex-lg-row justify-content-lg-end">
<li class="nav-item me-4 me-xxl-5">
<a class="nav-link" href="https://dev.to/badiali">Blog</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://www.badiali.es">Contacto</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</nav>
<button class="navbar-toggler d-lg-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#navbarOffcanvasLg" aria-controls="navbarOffcanvasLg">
<i class="fa-solid fa-bars"></i>
</button>
</header>
<main class="main">
<figure class="cover-image position-relative w-100 vh-100 d-flex align-items-center justify-content-center mb-0">
<figcaption class="cover-image__title position-relative text-center px-3 px-md-0">
<h1 class="display-1 text-uppercase fw-semibold mb-4">
Diseño UI/UX<br>
Web Dev
</h1>
<p class="lead text-center mb-5">
Hola 👋 soy Luis Badiali <br>
Me dedico al diseño UI/UX y desarrollo frontend<br>
Apasionado del mar, la vela y el arte.
</p>
<a class="btn btn-sm btn-dark text-uppercase px-4 py-3 rounded-0" href="https://www.badiali.es">Contactar</a>
</figcaption>
<div class="mouse position-absolute">
<div class="mouse-scroll position-relative bg-white"></div>
</div>
</figure>
<section class="container py-5">
<h2 class="text-uppercase mb-4">
Lorem ipsum <strong>dolor sit amet</strong>
<small class="d-block text-muted">Doloribus fuga totam quis</small>
</h2>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Est ut soluta culpa natus error totam. Doloribus fuga totam quis harum deleniti aspernatur, amet odio voluptatibus in reprehenderit ducimus nostrum ut!</p>
</section>
</main>
// Header
.header {
padding-top: 1.8rem;
padding-bottom: 1.8rem;
.nav-link,
.navbar-brand,
.navbar-toggler i {
color: white;
transition: color 0.2s linear;
&:hover {
color: mediumpurple;
}
}
.navbar-brand {
font-size: 1.8rem;
}
.navbar-toggler {
position: absolute;
top: 50%;
transform: translateY(-50%);
right: 2rem;
i {
font-size: 1.5rem;
}
}
&.headroom {
transition: all 0.2s linear;
}
&.headroom--top,
&.headroom--top.headroom--pinned {
background-color: transparent;
}
&.headroom--not-top.headroom--pinned {
padding-top: 0.5rem;
padding-bottom: 0.5rem;
background-color: rgba(white, 0.9);
.nav-link,
.navbar-brand,
.navbar-toggler i {
color: black;
}
}
&.headroom--pinned {
transform: translateY(0%);
}
&.headroom--unpinned {
transform: translateY(-100%);
}
}
// Offcanvas
.offcanvas {
.fa-close {
font-size: 1.8rem;
}
&.show {
.row {
padding-top: 2rem!important;
}
.nav-link {
color: black;
}
}
}
// Cover
.cover-image {
min-height: 600px;
color: white;
background: url("https://bit.ly/3Rj3yMN") no-repeat center;
background-size: cover;
&__title {
text-shadow: 3px 3px 2px rgba(black, 0.3);
z-index: 1;
}
&::before {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 0;
background: black;
background: linear-gradient(
180deg,
rgba(black, 0.7) 0%,
rgba(black, 0) 30%
);
}
}
// General
@media (max-width: 767px) {
p.lead {
font-size: 1rem;
}
}
@media (min-width: 1200px) {
[class*="container"] {
max-width: 1000px;
}
}
// Mouse
.mouse {
bottom: 2rem;
left: 50%;
transform: translateX(-50%);
width: 30px;
height: 47px;
border: 2px solid white;
border-radius: 14px;
.mouse-scroll {
top: 10px;
left: 11px;
width: 4px;
height: 4px;
border-radius: 2px;
animation: mouse 1.5s ease-out infinite;
}
}
@-webkit-keyframes mouse {
0% {
top: 4px;
opacity: 0;
height: 4px;
}
50% {
top: 8px;
opacity: 1;
height: 10px;
}
to {
top: 12px;
opacity: 0;
height: 4px;
}
}
// grab an element
var myElement = document.querySelector(".header");
// construct an instance of Headroom, passing the element
var headroom = new Headroom(myElement);
// initialise
headroom.init();
Also see: Tab Triggers